fix(buffer): copyCellsFrom metadata scope and reflow isWrapped cleanup#5997
Draft
Tyriar wants to merge 3 commits into
Draft
fix(buffer): copyCellsFrom metadata scope and reflow isWrapped cleanup#5997Tyriar wants to merge 3 commits into
Tyriar wants to merge 3 commits into
Conversation
copyCellsFrom copied Uint32 cell data only for the requested column range but migrated every combined entry with key >= srcCol, which could attach grapheme metadata to unrelated destination columns during partial line copies in reflow and wraparound. Copy combined and extended attributes only per copied cell and clear stale entries on the destination when the source cell does not use them. Co-authored-by: Cursor <cursoragent@cursor.com>
When widening the terminal unwraps a multi-row soft wrap and removes trailing buffer lines, the last retained row could still have isWrapped set, and the following line could still think it continued a removed row. That broke wrapped range translation. Clear isWrapped on the last retained row in the group and on the first line after the group when rows are removed during reflow. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Cherry-picks from
Tyriar/explore-correctness(commits992cc5c,cd4da10d), with a small merge adaptation onmasterfor_copyCellMapsFrom.1.
BufferLine.copyCellsFrom— limit combined/extended metadata to copied rangecopyCellsFromcopied Uint32 cell data only for the requested column range, but previously migrated every_combinedentry with key>= srcCol. Partial line copies during reflow and wraparound could therefore attach grapheme metadata to unrelated destination columns.Fix: Copy combined and extended attributes only per cell in the copied range, and delete stale entries on the destination when the source cell does not use them. On current
master, this is implemented by extending_copyCellMapsFrom(used bycopyCellsFromandcopyFrom) to clear stale_combined/_extendedAttrskeys when flags are absent.Risk: Any path that partially copies cells between lines (reflow, wraparound, scroll regions).
Tests:
BufferLine.test.ts—copyCellsFrom/should only move combined data within the copied range.2.
reflowLargerGetLinesToRemove— clear staleisWrappedafter larger reflowWhen widening the terminal unwraps a multi-row soft wrap and removes trailing buffer lines, the last retained row could still have
isWrappedset, and the following line could still think it continued a removed row. That broke wrapped-range string translation.Fix: When rows are removed during reflow, clear
isWrappedon the last retained row in the group (wrappedLines[destLineIndex]) and on the first line after the group if present.Risk: Resize/reflow and any feature that depends on correct wrap continuation across buffer lines (search, selection, translation).
Tests:
BufferReflow.test.ts—reflowLargerGetLinesToRemove/should clear isWrapped on the last retained row after unwrap, plus existing cursor/reflow guard tests onmaster.Verification