Skip to content

terminal: keep CHA, VPA, HPR and VPR origin-relative - #14762

Merged
mitchellh merged 1 commit into
ghostty-org:mainfrom
jcollie:esctest-origin-mode
Oct 19, 2026
Merged

mitchellh merged 1 commit into
ghostty-org:mainfrom
jcollie:esctest-origin-mode

Conversation

@jcollie

@jcollie jcollie commented Oct 18, 2026

Copy link
Copy Markdown
Member

In origin mode setCursorPos takes coordinates relative to the scrolling region, but the stream handlers for CHA/HPA, VPA, HPR and VPR built them from the cursor's absolute screen position. The coordinate each meant to keep, or move relative to, then had the margin offset added a second time.

Add setCursorRow, setCursorCol, cursorRowRelative and cursorColRelative to Terminal, which convert the cursor position into origin-relative coordinates first, as xterm's CursorRow and CursorCol do, and use them from both stream handlers.

Fixes esctest's test_CHA_RespectsOriginMode, test_HPR_IgnoresOriginMode and test_VPR_IgnoresOriginMode.

AI disclosure: Claude Code was used in the preparation of this PR.

In origin mode setCursorPos takes coordinates relative to the scrolling
region, but the stream handlers for CHA/HPA, VPA, HPR and VPR built them
from the cursor's absolute screen position. The coordinate each meant to
keep, or move relative to, then had the margin offset added a second
time.

Add setCursorRow, setCursorCol, cursorRowRelative and cursorColRelative
to Terminal, which convert the cursor position into origin-relative
coordinates first, as xterm's CursorRow and CursorCol do, and use them
from both stream handlers.

Fixes esctest's test_CHA_RespectsOriginMode, test_HPR_IgnoresOriginMode
and test_VPR_IgnoresOriginMode.
@jcollie
jcollie requested a review from a team as a code owner October 18, 2026 21:15
@ghostty-bot ghostty-bot Bot added the vt Control sequence related label Oct 18, 2026
@jcollie jcollie added this to the 1.4.0 milestone Oct 19, 2026
@mitchellh
mitchellh merged commit 746c895 into ghostty-org:main Oct 19, 2026
106 checks passed
@jcollie
jcollie deleted the esctest-origin-mode branch October 19, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

vt Control sequence related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants