Skip to content

CUP at screen boundaries

Category: cursor · Baseline: core · Tags: ECMA-48 Standard, VT100 · Specification ↗

CUP (Cursor Position, CSI row ; col H) with out-of-bounds parameters should clamp the cursor to the screen edges rather than wrapping or producing undefined behavior. Sending CSI 999 ; 999 H should place the cursor at the last row and last column of the visible screen. This is important for applications that use CUP with large values as a shorthand for "move to bottom-right corner" without querying screen dimensions first.
How this is testedautomated
Send \x1b[999;999H, verify cursor is at (rows-1, cols-1) — not beyond the screen boundaries.

The same probe runs against headless backends (via Termless) and real terminal apps (via a daemon launched in each terminal). This lets us distinguish parser correctness from rendering correctness.

Analysis2026-04-06

Supported by 6 of 12 terminals (50%). Part of the Core TUI baseline. Notes: WezTerm: CUP boundary behavior differs in wezterm-term headless mode.

Supported by 7 of 14 backends (50%)

Terminal Applications

TerminalVersionSupportNotes
Terminal.app✓ yes
iTerm23.6.9✗ nogot 25;80, expected within screen bounds
Ghostty1.3.1✗ nogot 119;270, expected within screen bounds
VS Code✗ no
Warp✗ no
Cursor✗ no

Headless Backends

Parser correctness only — a means the parser accepts the sequence.

BackendVersionSupportNotes
Alacritty0.26.0✓ yes
Kitty0.40.0✓ yes
vt100.js0.2.1✓ yes
vterm0.2.0✓ yes
xterm.js5.5.0✓ yes
WezTerm0.1.0-fork.5✗ noCUP boundary behavior differs in wezterm-term headless mode