^[control-codes
live in libghostty-vt

Control sequences

REP Repeat

View as Markdown

Print the character before it n more times.

CSI Pn b
Defaults
Pn = 1
ECMA-48
§8.3.103 REP – Repeat, p. 55
xterm
Functions using CSI

Print the graphic character that came immediately before REP another Pn times. It is a compression: A\e[3b puts four As on the screen, exactly as AAAA would, so the repeats wrap at the right margin and scroll at the bottom margin like any other printed characters.

ECMA-48 defines the repeat only when the character just before REP is a graphic character, including a space. If it is a control function, or part of one, ECMA-48 leaves the effect undefined, so REP should come straight after the character it repeats.

Neither DEC STD 070 nor the VT510 manual has REP. xterm implements it, and lists it among its control sequences as “Repeat the preceding graphic character”.

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984Nonot in the manual
VT510manual, 1st ed., 1993Nonot in the manual
xtermpatch 412, xterm-411aYes
libghostty-vt0f171f6Yes
kitty0.49.1, run in a VMPartlyfails REP-3, REP-4 of the 4 cases that show it working
foot1.28.0, run in a VMPartlyfails REP-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 REP-4 of the 4 cases that show it working
alacritty_terminal0.26.0, run as a libraryPartlyfails REP-4 of the 4 cases that show it working
ConEmubuild 230724, its documentationYes“Repeats output of last written character count times”; ANSI escape codes
rxvt-unicode9.31, run in a VMNofails the 4 cases that show it working
VTE0.84.1, run as a libraryPartlyfails REP-3 of the 4 cases that show it working

Validation

REP-1: Repeat once

A\e[b
|AA___|
cursor 1,3

REP-2: Repeat three times

A\e[3b
|AAAA_|

REP-3: Wraps like printing

\e[1;4H
A\e[3b
|___AA|
|AA___|
cursor 2,3

REP-4: Inside left and right margins

\e[?69h   # allow left and right margins
\e[2;4s   # margins at columns 2 and 4
\e[1;2H
a\e[3b
|_aaa_|
|_a___|
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.