Repository navigation
Conversation
Hard-tab cursor moves use terminal tab stops that were only set at startup. After a widen, columns beyond the old width had no stops, so tabs landed on the right margin and corrupted the row. When hard tabs are enabled, resize now refreshes SetTabStops for the new width and re-emits DECST8C, matching the startup path. Fixes charmbracelet#1838
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.
Description
Fixes #1838.
Hard-tab cursor moves rely on terminal tab stops set with
DECST8C(ESC[?5W). The cursed renderer only emitted that sequence on the first render (s.starting && s.hardTabs). After a widening resize, the renderer's own tab-stop model grew withResize, but the terminal still only had stops for the old width. Tabs past the last known stop landed on the right margin and corrupted the row (especially near the right edge).When hard tabs are enabled,
resize()now:SetTabStops(s.width)for the new width (same asreset()).ansi.SetTabEvery8Columns, matching the startup path.Hard tabs off is unchanged. The initial start-time restore is unchanged.
Checklist
Testing
TestCursedRenderer_restoresTabStopsOnResizechecks thatDECST8Cis emitted on the first render and again after a widen when hard tabs are on, and not at all when hard tabs are off.AI assistance
This change was written with the help of an AI coding assistant (Cursor).