Skip to content

Save/restore cursor (?1048)

Category: modes · Baseline: modern · Tags: Xterm Extensions, DEC Private Modes · Specification ↗

CSI ? 1048 h/l
DECSET 1048 saves the current cursor position and attributes; DECRST 1048 restores them. The sequences are ESC [ ? 1048 h (save) and ESC [ ? 1048 l (restore). Unlike ?1049, this mode does not switch to the alternate screen — it only manipulates the cursor save/restore state. Mode 1048 is one of the three ingredients that ?1049 combines (cursor save + ?1047 alt screen + clear). Applications that need to checkpoint the cursor without entering the alt screen can use ?1048 directly, or use the older DECSC/DECRC (ESC 7 / ESC 8) which performs the same operation.
How this is testedautomated
Position cursor, send \x1b[?1048h (save), move elsewhere, send \x1b[?1048l (restore), verify cursor returned to saved position.

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 5 of 9 terminals (56%). Not supported by: Kitty, Terminal.app, vterm.js, vt100.js. Part of the Modern TUI baseline. Notes: Kitty: ?1048 save/restore cursor not exposed via Python batch bridge; vterm.js: ?1048 save/restore cursor not implemented in vterm.js; vt100.js: Alt screen variants not supported in vt100.js baseline.

Supported by 5 of 14 backends (36%)

Terminal Applications

TerminalVersionSupportNotes
iTerm23.6.9✓ yes
Ghostty1.3.1✓ yes
Terminal.app2.15✗ nogot 15;20, expected 5;10
Kitty0.46.2✗ no?1048 save/restore cursor not exposed via Python batch bridge
VS Code1.113.0? unknown
Warp0.2026.03.18.08.24.03? unknown
Cursor2.6.21? unknown

Headless Backends

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

BackendVersionSupportNotes
WezTerm0.1.0-fork.5✓ yes
xterm.js5.5.0✓ yes
Alacritty0.26.0~ partial?1048 save/restore cursor not exposed in headless mode
vt100.js0.2.1✗ noAlt screen variants not supported in vt100.js baseline
vterm0.2.0✗ no?1048 save/restore cursor not implemented in vterm.js