Skip to main content

DECOM

AI-Generated Content
This page was generated with the assistance of AI and may contain inaccuracies. It is intended as a placeholder for future human verification. If you spot issues ahead of its initial review, please report them on GitHub!
Standard

DECOM (Mode 6) is a DECSET/DECRST mode that controls whether cursor positioning is relative to the scrolling region or absolute to the entire screen.

Syntax​

CSI ? 6 h    DECSET — Enable origin mode (relative positioning)
CSI ? 6 l DECRST — Disable origin mode (absolute positioning)
Formal syntax
DECSET-mode6 = 0x1b, "[", "?", "6", "h" ;
DECRST-mode6 = 0x1b, "[", "?", "6", "l" ;

Description​

Per the VT100 User Guide and VT510 Programmer Reference, DECOM controls the reference point for cursor positioning sequences such as CUP (CSI H) and HVP (CSI f).

  • Set (origin mode) — Cursor positioning is relative to the top of the scrolling region defined by DECSTBM. Row 1 refers to the first line of the scrolling region, and the cursor cannot move outside the region boundaries. The cursor is also confined within left/right margins if DECLRMM is enabled.
  • Reset (absolute mode) — Cursor positioning is relative to the top-left corner of the entire screen. Row 1 is the first line of the display regardless of any scrolling region. This is the default.

Side effects​

When DECOM is set or reset, the cursor moves to the home position. In origin mode, "home" is the top-left corner of the scrolling region. In absolute mode, "home" is row 1, column 1 of the screen.

Interaction with scrolling margins​

DECOM is designed to work with DECSTBM (Set Top and Bottom Margins) and DECLRMM/DECSLRM (Left and Right Margins). When origin mode is set:

  • CUP and HVP coordinates are offset by the margin origin
  • The cursor is confined within both the vertical scrolling region and horizontal margins
  • ED and EL still operate relative to the cursor position, not the margins
note

Applications that use scrolling regions typically enable DECOM so that their drawing coordinates are relative to the region, simplifying layout logic.

Examples​

# Set a scrolling region (rows 5-20), then enable origin mode
printf '\e[5;20r' # DECSTBM: set scroll region to rows 5-20
printf '\e[?6h' # DECOM: enable origin mode
printf '\e[1;1H' # CUP: moves to row 5, column 1 (top of scroll region)

# Disable origin mode
printf '\e[?6l' # DECOM: disable origin mode
printf '\e[1;1H' # CUP: moves to row 1, column 1 (top of screen)

Specifications​

SpecificationSection
VT510 Reference—

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✓YesOrigin mode implemented
Bobcat??Not explicitly configured in Bobcat. TerminalCtrl may support this, but cannot confirm from Bobcat's code.
contour✓v0.1.0DECOM (mode 6 - origin mode) implemented as DECMode::Origin in primitives.h lines 663-663 with full documentation, set via Terminal.cpp line 2484, affects cursor positioning relative to margins
foot✓YesOrigin mode (relative to scroll region)
Ghostty✓v1.0.0Origin mode
iTerm2✓YesOrigin mode for cursor positioning relative to scroll region
Kitty✓Yes
Konsole✓YesOrigin mode for relative positioning within scroll region
mintty✓YesDECOM (Mode 6) origin mode implemented at src/termout.c:2415-2420
mlterm✓YesFundamental VT100 mode, present since early versions
PuTTY✓0.45DEC origin mode at terminal.c:3100-3102
Rio??
rxvt-unicode✓1.2PrivMode_relOrigin - Origin mode
st✓0.4
terminology✓v0.1.0
VT100✓Yes
VTE✓YesDEC_ORIGIN mode
WezTerm✓20200202-181957-765184e5Origin mode (relative to scroll region)
Windows Terminal✓Yes
xterm✓xterm-1DECOM (mode 6) - Origin mode (relative to scroll region)
xterm.js✓0.10Origin mode
Multiplexers
cy✓Yes
GNU Screen✓v.4.2.0Origin mode (src/ansi.c:1108-1115)
tmux✓2.9
tuios✓v0.0.15Origin mode (ModeOrigin)
Zellij✓v0.31.2

See also​