Skip to main content

REP

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

REP (Repeat) is a CSI sequence that repeats the preceding graphic character a specified number of times.

Syntax​

CSI Pn b      REP — Repeat preceding character
Formal syntax
REP = 0x1b, "[", [ Pn ], "b" ;
Pn  = digit, { digit } ;                (* default: 1 *)
digit = "0" | "1" | "2" | "3" | "4"
    | "5" | "6" | "7" | "8" | "9" ;

Parameters​

ParameterDescriptionDefault
PnNumber of times to repeat1

Description​

Per ECMA-48 §8.3.103, REP causes the preceding graphic character (including SPACE) to be repeated Pn times. The character is printed at the current cursor position and the cursor advances normally as if the character had been typed that many times.

If the preceding data-stream element is a control function rather than a graphic character, the effect of REP is not defined by the standard. In practice, most terminals ignore REP in that case.

REP is useful for run-length compression of repeated characters in the output stream, reducing bandwidth when sending large blocks of identical characters (e.g., filling a line with dashes or spaces).

Examples​

printf 'A\e[4b'     # Print "A" then repeat it 4 times → "AAAAA"
printf '-\e[79b' # Print 80 dashes (1 + 79 repeats)

Specifications​

SpecificationSection
ECMA-48—

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✓0.6.0Bug fix in 0.7.0 indicates implementation before then
Bobcat✓0.9.0Supported via TerminalCtrl library
contour✓v0.3.0.198
foot✓YesREP (b) at csi.c:794-820
Ghostty✓v1.0.0
iTerm2✓YesVT100CSI_REP token parsed and executed via terminalRepeatPreviousCharacter
Kitty✓YesREP (CSI b) fully implemented in vt-parser.c:1191-1192
Konsole✓YesREP (b) implemented at src/Vt102Emulation.cpp:2146
mintty✓YesREP (CSI b) at line 3119-3127, repeats preceding graphic character
mlterm✓rel-2_9_0Implemented at vt_parser.c:5773-5789
PuTTY✓0.71
Rio✓v0.0.3
rxvt-unicode✗NoCSI_REP defined but no handler implemented
st✓0.8.4
terminology✓v1.4.0
VT100✗No
VTE✓YesFully implemented in vteseq.cc as REP handler
WezTerm✓YesREP implemented as Edit::Repeat in wezterm-escape-parser/src/csi.rs:1230 and term/src/terminalstate/mod.rs:2259
Windows Terminal✓YesHandled directly in OutputStateMachineEngine.cpp:577. Repeats last printable character.
xterm✓xterm-406
xterm.js✓4.0.0Extended to support repeating grapheme clusters
Multiplexers
cy✗No
GNU Screen✗NoNo case 'b' handler in DoCSI
tmux✓2.6REP (CSI b) repeats previous graphic character
tuios✓v0.0.15
Zellij✓v0.9.0