Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

text: Wrap* should account for display width; fixes #344 #347

Merged
merged 2 commits into from
Dec 13, 2024
Merged

Conversation

jedib0t
Copy link
Owner

@jedib0t jedib0t commented Dec 13, 2024

The text package Wrap* functions were not accounting for display width when wrapping a word or a sentence. This changes fixes it.

Addl. change: rename RuneWidthWithoutEscSequences to StringWidthWithoutEscSequences in a backward compatible way.

@coveralls
Copy link

coveralls commented Dec 13, 2024

Pull Request Test Coverage Report for Build 12322158644

Details

  • 73 of 73 (100.0%) changed or added relevant lines in 11 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 12239986584: 0.0%
Covered Lines: 3824
Relevant Lines: 3824

💛 - Coveralls

@@ -111,7 +110,7 @@ func appendChar(char rune, wrapLen int, lineLen *int, inEscSeq bool, lastSeenEsc

// increment the line index if not in the middle of an escape sequence
if !inEscSeq {
*lineLen++
*lineLen += RuneWidth(char)
Copy link
Owner Author

@jedib0t jedib0t Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@L0nm4r this line was the buggy line resulting in misaligned text during wrapping.

@jedib0t jedib0t merged commit bfe1b7c into main Dec 13, 2024
6 checks passed
@jedib0t jedib0t deleted the text-wrap-fix branch December 13, 2024 19:59
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants