website: cbt

This commit is contained in:
Mitchell Hashimoto
2023-10-06 15:48:30 -07:00
parent cf01cd87a4
commit 73c079e07f

View File

@ -0,0 +1,83 @@
import VTSequence from "@/components/VTSequence";
# Cursor Backward Tabulation (CBT)
<VTSequence sequence={["CSI", "Pn", "Z"]} />
Move the cursor `n` tabs left.
The leftmost valid column for this operation is the first column. If
[origin mode](#TODO) is enabled, then the leftmost valid column for this
operatin is the [left margin](#TODO).
Move the cursor left until the cursor position is on a tabstop. If the
cursor would move past the leftmost valid column, the cursor remains at
the leftmost 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
### CBT V-1: Left Beyond First Column
```bash
printf "\033[?W" # reset tab stops
printf "\033[10Z"
printf "A"
```
```
|Ac________|
```
### CBT V-2: Left Beyond First Column
```bash
printf "\033[?W" # reset tab stops
printf "\033[1;10"
printf "X"
printf "\033[Z"
printf "A"
```
```
|________AX|
```
### CBT V-3: Left Starting on Tabstop
```bash
printf "\033[?W" # reset tab stops
printf "\033[1;9H"
printf "X"
printf "\033[1;9H"
printf "\033[Z"
printf "A"
```
```
|A_______X_|
```
### CBT V-4: Left Margin with Origin Mode
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?W" # reset tab stops
printf "\033[?6h" # enable origin mode
printf "\033[?69h" # enable left/right margins
printf "\033[3;6s" # scroll region left/right
printf "\033[1;2H" # move cursor in region
printf "X"
printf "\033[Z"
printf "A"
```
```
|__AX______|
```