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
| Parameter | Description | Default |
|---|---|---|
Pn | Number of lines to scroll | 1 |
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 byPnlines. 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 byPnlines. 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
| Specification | Section |
|---|---|
| ECMA-48 | — |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ✓ | 0.1.0 | Implemented via scroll_up/scroll_down methods |
| Bobcat | ✓ | 0.9.0 | Supported via TerminalCtrl library |
| contour | ✓ | v0.1.0 | |
| foot | ✓ | Yes | SU (S) at csi.c:1144-1149, SD (T) at csi.c:1151-1156 |
| Ghostty | ✓ | v1.0.0 | |
| iTerm2 | ✓ | Yes | XTERMCC_SU and XTERMCC_SD tokens parsed and executed via terminalScrollUp and terminalScrollDown |
| Kitty | ✓ | Yes | SU/SD (CSI S/T) fully implemented in vt-parser.c:1360-1369 |
| Konsole | ✓ | Yes | SU (S), SD (T) implemented at src/Vt102Emulation.cpp:2136-2137 |
| mintty | ✓ | Yes | SU (CSI S) at line 3435-3437, SD (CSI T) at line 3438-3443 |
| mlterm | ✓ | rel-2_9_0 | SU 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 | ✓ | Yes | Fully implemented in vteseq.cc as SU/SD handlers |
| WezTerm | ✓ | Yes | SU (ScrollUp) and SD (ScrollDown) implemented as Edit::ScrollUp and Edit::ScrollDown |
| Windows Terminal | ✓ | Yes | Implemented 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.0 | Handles CSI S/T/^ for scrolling |
| tmux | ✓ | 3.0a | SU (CSI S) added in 2.4; SD (CSI T) added in 3.0a |
| tuios | ✓ | v0.0.15 | |
| Zellij | ✓ | v0.1.0-alpha | |
See also
- IND — Index — Scroll up one line (at bottom margin)
- RI — Reverse Index — Scroll down one line (at top margin)
- DECSTBM — Set Top and Bottom Margins — Defines the scrolling region
- IL/DL — Insert/Delete Lines — Insert/delete at cursor position