Clear stale isWrapped when resize skips reflow for cursor line#5810
Closed
dolonet wants to merge 1 commit intoxtermjs:masterfrom
Closed
Clear stale isWrapped when resize skips reflow for cursor line#5810dolonet wants to merge 1 commit intoxtermjs:masterfrom
dolonet wants to merge 1 commit intoxtermjs:masterfrom
Conversation
When resizing to a wider layout and the cursor sits inside a wrapped line group, reflowLarger intentionally skips merging that group to avoid disturbing the cursor. The wrapped rows were left with isWrapped=true even though their content no longer wraps in the new width, which made triple-click (and any isWrapped-driven logic) treat the now-visually-separate rows as a single logical line. Clear isWrapped on any continuation row whose predecessor no longer fills the new last column. The predecessor's last cell has been null-padded during the pre-reflow line resize, so hasContent(newCols-1) is a reliable test. Fixes #3482
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.
Fixes #3482.
What
When resizing to a wider terminal,
_reflowLargerskips merging a wrapped-line group if the cursor is inside that group — the comment already notes that "the program will handle fixing up wrapped lines with the cursor". But the wrapped rows keepisWrapped = trueeven though their content no longer wraps in the new width. Any consumer ofisWrapped(triple-click selection is the user-visible symptom in the issue) then treats the now-visually-separate rows as a single logical line.Fix
Inside the cursor-skip branch, clear
isWrappedon any continuation row whose predecessor no longer fills the new last column. The predecessor's last cell has already been null-padded by the pre-reflow line resize, sohasContent(newCols - 1)is a reliable signal that the wrap cannot exist at the new width.Content on the cursor line is deliberately left alone — only the flag is cleaned up, matching the "program will fix up" contract.
Repro
Before:
After:
line1.isWrapped === false; triple-click selects only one row.Test
Added
should clear stale isWrapped when the cursor is on a wrapped line and reflow is skipped (#3482)inBuffer.test.ts.