fix(wrap): keep wrapped text and cursor visible - #38
Merged
Merged
Conversation
- centralize wrapping, measurement, rendering, and hit-test geometry - reserve a terminal cell for wrapped caret placement - split oversized words instead of clipping their trailing characters - retain WordOrGlyph as a documented compatibility variant - add exact-width and alignment regression coverage
- Split word-mode whitespace runs into independently wrapable grapheme units. - Fill remaining visual-row cells before wrapping excess whitespace. - Keep Word and WordOrGlyph behavior compatible. - Add regressions for whitespace wrapping and rendered cursor placement.
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.
Problem
Active wrapping could place the native cursor outside the textarea when content exactly filled the drawable width. In word-based modes, oversized words could also be clipped, and a trailing whitespace run could move atomically to a continuation row, briefly placing the cursor in the middle of an otherwise blank row.
Change Summary
WrapMode::None.WordandWordOrGlyphbehavior equivalent while retainingWordOrGlyphfor source and serialization compatibility.Test Evidence
cargo fmt --all -- --checkcargo clippy --all-targets -- -D warningscargo check --offlinecargo testclaude-code-rustconsumer test and clippy suites against the local path dependencyBreaking Changes
No source-level breaking changes. Wrapped modes can wrap one cell earlier because they now reserve space for the native caret.
Wordnow splits oversized words at grapheme boundaries instead of allowing trailing content to be clipped, andWordOrGlyphremains available with the same corrected behavior.WrapMode::Noneretains horizontal scrolling.