ghostty/website/app/vt/cht/page.mdx

71 lines
1.7 KiB
Plaintext

import VTSequence from "@/components/VTSequence";
# Cursor Horizontal Tabulation (CHT)
<VTSequence sequence={["CSI", "Pn", "I"]} />
Move the cursor `n` tabs right.
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.
The rightmost valid column for this operation is the rightmost column in
the terminal screen or the [right margin](#TODO), whichever is smaller.
This sequence does not change behavior with [origin mode](#TODO) set.
Move the cursor right until the cursor position is on a tabstop. If the
cursor would move past the rightmost valid column, the cursor remains at
the rightmost valid column and the operation completes. Repeat this process
`n` times.
Tabstops are dynamic and can be set with escape sequences such as
[horizontal tab set (HTS)](/vt/hts), [tab clear (TBC)](/vt/tbc), etc.
A terminal emulator may default tabstops at any interval, though an interval
of 8 spaces is most common.
## Validation
### CHT V-1: Right Beyond Last Column
```bash
printf "\033[?W" # reset tab stops
printf "\033[100I" # assuming the test terminal has less than 800 columns
printf "A"
```
```
|_________A|
```
### CHT V-2: Right From Before a Tabstop
```bash
printf "\033[?W" # reset tab stops
printf "\033[1;2H"
printf "A"
printf "\033[I"
printf "X"
```
```
|_A______X_|
```
### CHT V-3: Right Margin
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?W" # reset tab stops
printf "\033[?69h" # enable left/right margins
printf "\033[3;6s" # scroll region left/right
printf "\033[1;1H" # move cursor in region
printf "X"
printf "\033[I"
printf "A"
```
```
|__AX______|
```