^[control-codes
live in libghostty-vt

Control sequences

SD Scroll Down

View as Markdown

Move the contents of the scrolling region down n lines.

CSI Pn T
Defaults
Pn = 1
ECMA-48
§8.3.113 SD – Scroll Down, p. 59
DEC STD 070
§5.5 Pan Up (Scroll Down), p. 5-92
VT510
SD—Pan Up

Move the lines of the scrolling region down Pn lines. The bottom Pn lines of the region are lost, and Pn blank lines appear at the top margin. A 0 is taken as 1. The cursor does not move.

Like SU, and unlike IL, SD scrolls the whole scrolling region wherever the cursor is, and with left and right margins set moves only the part of each line between them.

DEC STD 070 and the VT510 manual call it Pan Up: in DEC’s windowing extension it moves the window up a page of display memory taller than the screen, bringing a new line into view at the top, rather than moving any data. The SU page explains the difference. xterm, like libghostty-vt, moves the lines, and documents CSI Ps T as “Scroll down Ps lines”.

xterm also scrolls down for CSI Ps ^, which ECMA-48 assigns to SIMD; that page explains why.

With five parameters, CSI Ps ; Ps ; Ps ; Ps ; Ps T is a different sequence in xterm, XTHIMOUSE, which starts highlight mouse tracking.

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984Nonot in the manual
VT510manual, 1st ed., 1993YesSD—Pan Up: pans the window rather than moving lines
xtermpatch 412, xterm-411aYes
libghostty-vt0f171f6Yes
kitty0.49.1, run in a VMPartlyfails SD-4 of the 4 cases that show it working
foot1.28.0, run in a VMPartlyfails SD-4 of the 4 cases that show it working
pyte0.8.2, run as a libraryNofails the 4 cases that show it working
xterm.js headless6.0.0, run as a libraryPartlyfails SD-4 of the 4 cases that show it working
alacritty_terminal0.26.0, run as a libraryPartlyfails SD-4 of the 4 cases that show it working
ConEmubuild 230724, its documentationPartlyscrolls the whole buffer down, not the scrolling region; ANSI escape codes
rxvt-unicode9.31, run in a VMPartlyfails SD-4 of the 4 cases that show it working
VTE0.84.1, run as a libraryYespasses the 4 cases that show it working

Validation

SD-1: Scroll one line

1\r\n2\r\n3\r\n4
\e[2;3H
\e[T
|_____|
|1____|
|2____|
|3____|
cursor 2,3

SD-2: Scroll two lines

1\r\n2\r\n3\r\n4
\e[2T
|_____|
|_____|
|1____|
|2____|

SD-3: The scrolling region, with the cursor outside it

1\r\n2\r\n3\r\n4
\e[2;3r   # region is lines 2 and 3; homes the cursor, above it
\e[T
|1____|
|_____|
|2____|
|4____|
cursor 1,1

SD-4: Inside left and right margins

abcde\r\nfghij\r\nklmno\r\npqrst\r\nuvwxy
\e[?69h   # allow left and right margins
\e[2;4s   # margins at columns 2 and 4
\e[2;3H
\e[2T
|a___e|
|f___j|
|kbcdo|
|pghit|
|ulmny|
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.