Skip to main content
ansicode

DECOM ?6 — Origin mode (clip cursor addressing to scroll region)

Make the cursor's row/column origin (1,1) be the top-left of the DECSTBM region instead of the screen.

Byte forms

Every common string-literal form so you can paste-and-search either direction.

\\x1b[\x1b[?6h (origin = region) \x1b[?6l (origin = screen)
\\033[\033[?6h / \033[?6l
\\e[\e[?6h / \e[?6l
ESC [ESC [ ? 6 h / l
hex1b 5b 3f 36 68 / 6c

Description

Origin Mode. With DECSTBM (`\x1b[T;Br`) you carve out a scrolling region; DECOM controls whether subsequent cursor-position commands (`\x1b[r;c H` CUP, `\x1b[6n` DSR-CPR, etc.) address the region as if its top-left were (1,1) (`?6h` set) or the full screen (`?6l` reset, default). With `?6h` set: `\x1b[1;1H` moves to the region's top-left, the cursor cannot leave the region, and DSR-CPR reports relative coordinates. Used in full-screen forms-style TUIs that want a fixed status bar at row 1 of the screen while the body — a sub-rectangle from row 2 to row N-1 — behaves as if it were the whole canvas. Note: DECOM is one of the two state bits saved/restored by DECSC (`\x1b7`) / DECRC (`\x1b8`).

Spec citation: xterm-ctlseqs (DECOM, Private mode 6)

Examples

bash
printf '\033[2;23r\033[?6h\033[1;1H'   # region = rows 2..23; origin mode on; CUP to its top-left
python
import sys; sys.stdout.write('\x1b[?6h')
go
fmt.Print("\x1b[?6h")
javascript
process.stdout.write('\x1b[?6h')
c
printf("\x1b[?6h");

Terminal support

xterm
yes
Linux console (fbcon)
yes
macOS Terminal.app
yes
iTerm2
yes
Windows Terminal
partial
cmd.exe / ConPTY
no
kitty
yes
alacritty
yes
WezTerm
yes
Ghostty
yes
GNOME Terminal
yes
Konsole
yes
tmux
no
GNU screen
no

Related sequences