DECSET ?1047 — Alt screen without cursor save
Switch to / from the alt screen WITHOUT saving the cursor — the bare-bones precursor to ?1049.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\x1b[?1047h (enter alt) \x1b[?1047l (leave alt)\033[?1047h / \033[?1047l\e[?1047h / \e[?1047lESC [ ? 1 0 4 7 h / l1b 5b 3f 31 30 34 37 68 / 6cDescription
Three private modes exist for alt-screen handling — `?47`, `?1047`, and `?1049`. **`?1047`** switches to/from the alt screen but does NOT save or restore the cursor; **`?1048`** ONLY saves/restores the cursor (no screen switch); **`?1049`** is the modern composite: save cursor + enter alt + clear, and on exit restore alt → main + restore cursor. Apps that genuinely don't care about cursor position (animation toys, simple status-bar utilities) can save bytes with `?1047`. Apps that need both (vim, less, tmux, htop) emit `?1049` — never the lower-level pair. Note: when leaving alt-screen via `?1047l` xterm also clears the main screen before flipping, which can surprise applications expecting a non-destructive flip.
Spec citation: xterm-ctlseqs (Private mode 1047)
Examples
printf '\033[?1047h' # switch to alt; cursor position NOT saved\nprintf '\033[?1047l' # back to main; main screen is cleared firstimport sys; sys.stdout.write('\x1b[?1047h')fmt.Print("\x1b[?1047h")process.stdout.write('\x1b[?1047h')printf("\x1b[?1047h");Terminal support
- xterm
- yes
- Linux console (fbcon)
- no
- macOS Terminal.app
- yes
- iTerm2
- yes
- Windows Terminal
- yes
- cmd.exe / ConPTY
- partial
- kitty
- yes
- alacritty
- yes
- WezTerm
- yes
- Ghostty
- yes
- GNOME Terminal
- yes
- Konsole
- yes
- tmux
- no
- GNU screen
- no
| xterm | Linux console (fbcon) | macOS Terminal.app | iTerm2 | Windows Terminal | cmd.exe / ConPTY | kitty | alacritty | WezTerm | Ghostty | GNOME Terminal | Konsole | tmux | GNU screen |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| yes | no | yes | yes | yes | partial | yes | yes | yes | yes | yes | yes | no | no |