^[control-codes
live in libghostty-vt

Control sequences

SIMD Select Implicit Movement Direction

View as Markdown

ECMA-48's choice of which way text runs, which xterm takes as Scroll Down.

CSI Ps ^
Defaults
Ps = 0
ECMA-48
§8.3.120 SIMD – Select Implicit Movement Direction, p. 63
xterm
Functions using CSI

In ECMA-48, CSI Ps ^ chooses which way the active position moves after a character is written: 0 the same way as the character path, 1 the opposite way, for text that runs right to left. It belongs with the standard’s other functions for bidirectional text, listed on the rest of ECMA-48 page, which no terminal on this site implements.

xterm does something else with it. Its parser sends a final ^ to SD (VTPrsTbl.c), and the handler says it is there to “cater to ECMA-48’s typographical error” (CASE_SD). xterm’s control sequence documentation lists CSI Ps ^ as “Scroll down Ps lines”, and calls it a publication error in the 1991 edition of ECMA-48 that was corrected in 2003. The copy of the fifth edition this site links to already gives SD as CSI Pn 05/04, that is CSI Pn T, in §8.3.113, p. 59 and puts SIMD at 05/14 in its table of final bytes (Table 3, p. 11), so the error was presumably in another printing.

Either way, a default xterm scrolls: CSI Ps ^ moves the scrolling region down Ps lines exactly as CSI Ps T does, with 0 taken as 1, and the parameter’s ECMA-48 meaning plays no part. The cases follow xterm. libghostty-vt has no case for ^ in its CSI dispatch and ignores the sequence, so they are marked as known differences.

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984Nonot in the manual
VT510manual, 1st ed., 1993Nonot in the manual
xtermpatch 412, xterm-411aNotakes CSI Ps ^ as SD and scrolls down; the ECMA-48 meaning plays no part
libghostty-vt0f171f6Noignored; SIMD-1 to SIMD-4: does not scroll, as xterm does
ConEmubuild 230724, its documentationNonot in ConEmu’s list; ANSI escape codes

Validation

SIMD-1: xterm scrolls down one line

ABC\r\n
DEF\r\n
GHI
\e[^
|____|
|ABC_|
|DEF_|
cursor 3,4

SIMD-2: The ECMA-48 parameter is a count

ABC\r\n
DEF\r\n
GHI
\e[1^     # ECMA-48: the opposite direction
|____|
|ABC_|
|DEF_|
cursor 3,4

SIMD-3: Two lines

ABC\r\n
DEF\r\n
GHI
\e[2^
|____|
|____|
|ABC_|
cursor 3,4

SIMD-4: Within the scrolling region

ABC\r\n
DEF\r\n
GHI\r\n
JKL
\e[2;3r
\e[^
|ABC_|
|____|
|DEF_|
|JKL_|
cursor 1,1
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.