ghostty/website/app/vt/rep/page.mdx
Mitchell Hashimoto 96546af475 terminal: test REP
2023-10-11 17:23:27 -07:00

54 lines
1.3 KiB
Plaintext

import VTSequence from "@/components/VTSequence";
# Repeat Previous Character (REP)
<VTSequence sequence={["CSI", "Pn", "b"]} />
Repeat the previously printed character `n` times.
The parameter `n` must be an integer greater than or equal to 1. If `n` is less than
or equal to 0, adjust `n` to be 1. If `n` is omitted, `n` defaults to 1.
In xterm, only characters with single byte (less than decimal 256) are
supported. In most other mainstream terminals, any character is supported.
Each repeated character behaves identically to if it was manually typed in.
Therefore, soft-wrapping, margins, etc. all behave the same as if the
character was typed.
The previously printed character is any character that is printed through
any means. The previously printed character is not limited to characters
a user manually types. If there is no previously typed character, this sequence
does nothing.
## Validation
### REP V-1: Simple Usage
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "A"
printf "\033[b"
```
```
|AAc_______|
```
### REP V-2: Soft-Wrap
```bash
cols=$(tput cols)
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[${cols}G"
printf "A"
printf "\033[b"
```
```
|_________A|
|Ac________|
```