Repository navigation
terminal: fix crash after shrinking columns splits a wide char - #14509
Merged
Merged
Conversation
Narrowing without reflow cleared only the cells past the new width, so a wide char whose spacer tail was cut kept its head in the new last column. Every operation pairing a head with the cell after it then reached past the row end: insertBlanks and eraseLine(.left) panic in Screen.clearCells, and rowWillBeShifted writes cells[cols]. Clear the orphaned head along with the cut columns. Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
mitchellh
approved these changes
Oct 4, 2026
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.
Narrowing the terminal without reflow (wraparound off, or the alternate screen) can cut a wide char in half, leaving its head in the last column with no spacer tail.
Later edits on that row (e.g. ICH) then clear the missing tail too, reaching one cell past the row end, which leads to a bounds assertion failure in safe builds or an out-of-bounds write otherwise.
To reproduce, run the below script inside a safe build:
Screen.clearCells.survived, column 80 is blank.AI disclosure: Created with claude code using opus 5.5. Iterated on and reviewed by me.