Fixed(terminal-emulator): Make VPA, VPR and HPA respect origin mode - #5355
Open
matthematics1137 wants to merge 1 commit into
Open
matthematics1137 wants to merge 1 commit into
matthematics1137 wants to merge 1 commit into
Conversation
With origin mode (DECOM) on and a top margin below the first line: - VPA (`CSI Pn d`) ignored origin mode: it counted from the first line of the screen and was not limited to the scroll region. - VPR (`CSI Pn e`) and HPA (`CSI Pn \``) passed the absolute cursor row to setCursorPosition(), which takes a row relative to the top margin in origin mode, so the top margin was added a second time and the cursor jumped down (HPA moved it to another row altogether). VPA and VPR now count from the top margin and stop at the margins in origin mode, and HPA changes only the column, as in xterm (CursorSet). tmux does the same for VPA and HPA. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.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.
These bugs show with origin mode (DECOM,
CSI ? 6 h) on and a top marginbelow the first line:
CSI Pn d) ignores origin mode. It counts from the first line ofthe screen and is not limited to the scroll region.
CSI Pn e) and HPA (CSI Pn `) pass the absolute cursorrow to
setCursorPosition(). That function takes a row relative to the topmargin in origin mode, so the top margin is added twice and the cursor jumps
down. HPA even moves the cursor to another row.
To reproduce:
In xterm,
VandHboth land on line 3, the first line of the region. InTermux,
Vlands on line 1 andHon line 5.After this change, VPA and VPR count from the top margin and stop at the
margins in origin mode, and HPA changes only the column. This matches xterm
(
CursorSet()with the origin flag for VPA, VPR and HPA). tmux does the samefor VPA and HPA.
Test:
CursorAndScreenTest.testCursorPositionWithOriginModeAndTopMargin.