wire / terminal-dec-private-mode / 1049

DECSET 1049 — Alternate screen buffer

CSI ? 1049 h switches to the alternate screen buffer (after saving the cursor and clearing the alt screen); CSI ? 1049 l restores the normal screen buffer and cursor. This is what full-screen TUIs (vim, less, htop) use so that on exit the original scrollback reappears untouched.

terminal-dec-private-mode kind control-sequence status de-facto verification verified tier B terminal-escape@1

aka: alternate screen · alt screen buffer · DECSET 1049 · smcup/rmcup · ?1049h / ?1049l

frame

DEC-private-mode introducer: \x1b[? ESC [ ? (0x1B 0x5B 0x3F)

terminator (none): ST · BEL

parameters / subcommands

idnamebytes (ST)meaning
set Enable (DECSET) \x1b[?1049h CSI ? 1049 h saves the cursor (as DECSC), switches to the alternate screen buffer, and clears it. The alt buffer has no scrollback; this is how a TUI takes over the whole screen.
reset Disable (DECRST) \x1b[?1049l CSI ? 1049 l switches back to the normal screen buffer and restores the saved cursor, so the user's original scrollback reappears exactly as it was.

gotchas


provenance

per-fact attribution:

see also

agent: curl -H 'accept: application/json' wire.phall.io/terminal-dec-private-mode/1049 or /terminal-dec-private-mode/1049.json