Skip to main content
ansicode

SL / SR — Scroll left / right (CSI Ps SP @ / CSI Ps SP A)

Scroll the screen content left (SL) or right (SR) by Ps columns — the horizontal counterpart of CSI S / CSI T.

Byte forms

Every common string-literal form so you can paste-and-search either direction.

\\x1b[\x1b[<Ps> @ (SL) \x1b[<Ps> A (SR)
\\033[\033[1 @ / \033[1 A
\\e[\e[1 @ / \e[1 A
ESC [ESC [ Ps SP @ / ESC [ Ps SP A
hex1b 5b ... 20 40 / 1b 5b ... 20 41

Description

Shifts every cell on the screen (or within the active DECSTBM / DECSLRM region) `Ps` columns left (SL — final bytes `SP @`) or right (SR — final bytes `SP A`). Columns scrolled off the edge are discarded; the opposite edge is filled with blanks using the current SGR background. The intermediate byte is **literal space (0x20)** between the parameter and the final byte — easy to miss because the canonical ECMA-48 notation writes it as `SP`. SR shares its final byte `A` with CUU (cursor-up) but is unambiguous because of the intermediate space — parsers must distinguish on the presence of any 0x20..0x2f byte before the final. Common use-case is wide-table or code-viewer panes that scroll horizontally without redrawing the rest of the screen. Support is markedly thinner than vertical scroll (CSI S / CSI T) — Linux console, ConPTY, and several xterm clones treat SL/SR as a no-op.

Spec citation: ECMA-48 §8.3.121 (SL) / §8.3.135 (SR) / xterm-ctlseqs

Parameters

PsNumber of columns to scroll. Default 1 if omitted; values larger than the region width clear the region.

Examples

bash
printf '\033[3 @'   # scroll screen 3 cols left (note literal SPACE before @)
python
import sys; sys.stdout.write('\x1b[1 A')   # scroll 1 col right
go
fmt.Print("\x1b[2 @")   // scroll 2 cols left
javascript
process.stdout.write('\x1b[1 A')   // scroll 1 col right
c
printf("\x1b[5 @");  // scroll 5 cols left

Terminal support

xterm
yes
Linux console (fbcon)
no
macOS Terminal.app
no
iTerm2
partial
Windows Terminal
no
cmd.exe / ConPTY
no
kitty
yes
alacritty
partial
WezTerm
yes
Ghostty
yes
GNOME Terminal
partial
Konsole
yes
tmux
no
GNU screen
no

Related sequences