Repository navigation
text: keep wrapped lines within wrapLen when a wide rune would overflow - #435
Merged
jedib0t merged 1 commit intoOct 19, 2026
Merged
Conversation
Coverage Report for CI Build 39306915940Coverage remained the same at 100.0%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
jedib0t
force-pushed
the
fix-wrap-wide-rune-overflow
branch
from
October 19, 2026 18:57
16037b7 to
cc09e35
Compare
|
Owner
|
Thanks for the fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Proposed Changes
appendCharnow breaks the line before writing a rune when the line is non-empty andlineLen + RuneWidth(char) > wrapLen, soWrapHard/WrapSoft/WrapText(and tables usingWidthMax) never emit lines wider thanwrapLenfor wide (CJK) runes. A wide rune that can never fit (e.g.wrapLen1) is placed on its own line; zero-width combining marks now stay with their base rune instead of being split onto the next line.wrapHard/wrapSoftterminate the line whenlineLen >= wrapLen(was==), so the inter-word space isn't appended to an already-full line.WrapHard("世世世世世世", 3)now yields"世\n世\n世\n世\n世\n世"), added wide-rune tests for all three wrap functions (incl. escape sequences), and a table test checking that rows match the border width withWidthMax: 3and CJK content.Fixes #434.