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”.
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___|