-
Notifications
You must be signed in to change notification settings - Fork 269
(v2) fix: use non-breaking space for padding #489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a solid one. Let's get it into the release today.
CI failing. Tests need to be updated. |
Padding should use a non-breaking space so that the padding is preserved when the string is being copied and pasted, and wrapped to the next line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the code to use a non-breaking space (U+00A0) for padding, ensuring that the formatting is preserved during copy-paste and line wrapping.
- Updated expected output strings in table/table_test.go to include non-breaking spaces for padded text.
- Modified style.go to pass an explicit padding character (either a non-breaking space for padding or a regular space for margins) through updated padLeft, padRight, and pad functions.
Reviewed Changes
Copilot reviewed 77 out of 95 changed files in this pull request and generated no comments.
File | Description |
---|---|
table/table_test.go | Updated test expectations to reflect non-breaking space usage. |
style.go | Refactored padding functions to use a configurable padding rune. |
Files not reviewed (18)
- list/testdata/TestComplexSublist.golden: Language not supported
- list/testdata/TestEnumerators/alphabet.golden: Language not supported
- list/testdata/TestEnumerators/arabic.golden: Language not supported
- list/testdata/TestEnumerators/asterisk.golden: Language not supported
- list/testdata/TestEnumerators/bullet.golden: Language not supported
- list/testdata/TestEnumerators/dash.golden: Language not supported
- list/testdata/TestEnumerators/roman.golden: Language not supported
- list/testdata/TestEnumeratorsAlign.golden: Language not supported
- list/testdata/TestEnumeratorsTransform/alphabet_lower.golden: Language not supported
- list/testdata/TestEnumeratorsTransform/arabic).golden: Language not supported
- list/testdata/TestList.golden: Language not supported
- list/testdata/TestListIntegers.golden: Language not supported
- list/testdata/TestListItems.golden: Language not supported
- list/testdata/TestMultiline.golden: Language not supported
- list/testdata/TestSubListItems2.golden: Language not supported
- list/testdata/TestSublist.golden: Language not supported
- list/testdata/TestSublistItems.golden: Language not supported
- table/testdata/TestBorderColumnsWithExtraRows.golden: Language not supported
Comments suppressed due to low confidence (2)
style.go:13
- [nitpick] The constant 'nbsp' could be renamed to 'nonBreakingSpace' for improved clarity.
nbsp = '\u00A0'
style.go:532
- Ensure that all call sites of 'pad' are updated to pass the appropriate padding rune to avoid unintended padding behavior.
func pad(str string, n int, style *ansi.Style, r rune) string {
Padding should use a non-breaking space so that the padding is preserved when the string is being copied and pasted, and wrapped to the next line.
Now, we use
" "
for margins, and"\u00a0"
for paddings to preserve the surrounding spacing with the padded word.