Skip to main content

SU/SD

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

SU (Scroll Up) and SD (Scroll Down) are CSI sequences that scroll the contents of the scrolling region without moving the cursor.

Syntax​

CSI Pn S      SU — Scroll Up
CSI Pn T SD — Scroll Down
Formal syntax
SU = 0x1b, "[", [ Pn ], "S" ;
SD = 0x1b, "[", [ Pn ], "T" ;
Pn = digit, { digit } ;                 (* default: 1 *)
digit = "0" | "1" | "2" | "3" | "4"
    | "5" | "6" | "7" | "8" | "9" ;

Parameters​

ParameterDescriptionDefault
PnNumber of lines to scroll1

Description​

Per ECMA-48 §8.3.147 (SU) and §8.3.113 (SD):

  • SU (CSI Pn S) — Scrolls the content of the scrolling region up by Pn lines. New blank lines appear at the bottom of the scrolling region. Lines scrolled off the top may be added to the scrollback buffer.
  • SD (CSI Pn T) — Scrolls the content of the scrolling region down by Pn lines. New blank lines appear at the top of the scrolling region. Lines scrolled off the bottom are lost.

The cursor position is not changed by either operation. Only the content within the scrolling region (set by DECSTBM) is affected.

note

CSI T with more than one parameter is interpreted as mouse tracking (Highlight Mouse Tracking) rather than SD on some terminals. The single-parameter form is safe.

Examples​

printf '\e[5S'       # Scroll up 5 lines
printf '\e[3T' # Scroll down 3 lines

Specifications​

SpecificationSection
ECMA-48—

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✓0.1.0Implemented via scroll_up/scroll_down methods
Bobcat✓0.9.0Supported via TerminalCtrl library
contour✓v0.1.0
foot✓YesSU (S) at csi.c:1144-1149, SD (T) at csi.c:1151-1156
Ghostty✓v1.0.0
iTerm2✓YesXTERMCC_SU and XTERMCC_SD tokens parsed and executed via terminalScrollUp and terminalScrollDown
Kitty✓YesSU/SD (CSI S/T) fully implemented in vt-parser.c:1360-1369
Konsole✓YesSU (S), SD (T) implemented at src/Vt102Emulation.cpp:2136-2137
mintty✓YesSU (CSI S) at line 3435-3437, SD (CSI T) at line 3438-3443
mlterm✓rel-2_9_0SU at vt_parser.c:5709-5716, SD at 5717-5724
PuTTY✓0.45
Rio✓v0.0.3
rxvt-unicode✓1.2
st✓0.1
terminology✓v0.1.0
VT100✗No
VTE✓YesFully implemented in vteseq.cc as SU/SD handlers
WezTerm✓YesSU (ScrollUp) and SD (ScrollDown) implemented as Edit::ScrollUp and Edit::ScrollDown
Windows Terminal✓YesImplemented in ITermDispatch.hpp:56-57 as ScrollUp and ScrollDown
xterm✓xterm-406
xterm.js✓2.3.0
Multiplexers
cy✓v0.1.0
GNU Screen✓v.4.2.0Handles CSI S/T/^ for scrolling
tmux✓3.0aSU (CSI S) added in 2.4; SD (CSI T) added in 3.0a
tuios✓v0.0.15
Zellij✓v0.1.0-alpha

See also​