^[control-codes live in libghostty-vt

ANSI modes

HEM Character Editing Mode

Which way characters move when one is inserted or deleted.

CSI 10 h
ECMA-48
§7.2.9 HEM – Character Editing Mode, p. 23
DEC STD 070
§5.10.1.3 Modes That Cannot Be Changed, p. 5-134

Mode 10 decides which characters move when one is inserted with ICH or deleted with DCH. DEC STD 070 calls it Horizontal Editing Mode.

StateECMA-48 calls itMeaning
Reset, CSI 10 lFOLLOWINGthe characters at and after the cursor move right for an insertion, and left to close a deletion
Set, CSI 10 hPRECEDINGthe characters before the cursor move left for an insertion, and right to close a deletion

DEC STD 070 §5.10.1.3, p. 5-134 lists it among the X3.64 modes a DEC terminal may treat as fixed, as reset. The VT510 manual’s table of modes for DECRPM marks it as always reset. That is the way ICH and DCH work in xterm and libghostty-vt.

xterm ignores CSI 10 h and CSI 10 l (ansi_modes handles only modes 2, 4, 12 and 20), and DECRQM reports the mode as permanently reset, 4 (do_ansi_rqm). libghostty-vt ignores it too, but does not recognize the number, so it answers DECRQM with 0. Both DECRQM cases are known differences.

Validation

HEM-1: Reported as permanently reset

\e[10$p
|_____|
reply \e[10;4$y

HEM-2: Even after it is set

\e[10h
\e[10$p
|_____|
reply \e[10;4$y

HEM-3: ICH still pushes the characters after the cursor right

abc
\e[10h     # ignored
\e[1;2H
\e[@
|a_bc_|
cursor 1,2
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.