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
| Parameter | Description | Default |
|---|---|---|
Pn | Number of times to repeat | 1 |
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
| Specification | Section |
|---|---|
| ECMA-48 | — |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ✓ | 0.6.0 | Bug fix in 0.7.0 indicates implementation before then |
| Bobcat | ✓ | 0.9.0 | Supported via TerminalCtrl library |
| contour | ✓ | v0.3.0.198 | |
| foot | ✓ | Yes | REP (b) at csi.c:794-820 |
| Ghostty | ✓ | v1.0.0 | |
| iTerm2 | ✓ | Yes | VT100CSI_REP token parsed and executed via terminalRepeatPreviousCharacter |
| Kitty | ✓ | Yes | REP (CSI b) fully implemented in vt-parser.c:1191-1192 |
| Konsole | ✓ | Yes | REP (b) implemented at src/Vt102Emulation.cpp:2146 |
| mintty | ✓ | Yes | REP (CSI b) at line 3119-3127, repeats preceding graphic character |
| mlterm | ✓ | rel-2_9_0 | Implemented at vt_parser.c:5773-5789 |
| PuTTY | ✓ | 0.71 | |
| Rio | ✓ | v0.0.3 | |
| rxvt-unicode | ✗ | No | CSI_REP defined but no handler implemented |
| st | ✓ | 0.8.4 | |
| terminology | ✓ | v1.4.0 | |
| VT100 | ✗ | No | |
| VTE | ✓ | Yes | Fully implemented in vteseq.cc as REP handler |
| WezTerm | ✓ | Yes | REP implemented as Edit::Repeat in wezterm-escape-parser/src/csi.rs:1230 and term/src/terminalstate/mod.rs:2259 |
| Windows Terminal | ✓ | Yes | Handled directly in OutputStateMachineEngine.cpp:577. Repeats last printable character. |
| xterm | ✓ | xterm-406 | |
| xterm.js | ✓ | 4.0.0 | Extended to support repeating grapheme clusters |
| Multiplexers | |||
| cy | ✗ | No | |
| GNU Screen | ✗ | No | No case 'b' handler in DoCSI |
| tmux | ✓ | 2.6 | REP (CSI b) repeats previous graphic character |
| tuios | ✓ | v0.0.15 | |
| Zellij | ✓ | v0.9.0 | |