REP Repeat
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
| Terminal | Version | Support | Notes |
|---|---|---|---|
| VT220 | manual, 2nd ed., 1984 | No | not in the manual |
| VT510 | manual, 1st ed., 1993 | No | not in the manual |
| xterm | patch 412, xterm-411a | Yes | |
| libghostty-vt | 0f171f6 | Yes | |
| kitty | 0.49.1, run in a VM | Partly | fails REP-3, REP-4 of the 4 cases that show it working |
| foot | 1.28.0, run in a VM | Partly | fails REP-4 of the 4 cases that show it working |
| pyte | 0.8.2, run as a library | No | fails the 4 cases that show it working |
| xterm.js headless | 6.0.0, run as a library | Partly | fails REP-4 of the 4 cases that show it working |
| alacritty_terminal | 0.26.0, run as a library | Partly | fails REP-4 of the 4 cases that show it working |
| ConEmu | build 230724, its documentation | Yes | “Repeats output of last written character count times”; ANSI escape codes |
| rxvt-unicode | 9.31, run in a VM | No | fails the 4 cases that show it working |
| VTE | 0.84.1, run as a library | Partly | fails 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___|