website: cud

This commit is contained in:
Mitchell Hashimoto
2023-10-06 12:47:45 -07:00
parent c2af7b60d0
commit 4bbe449263
2 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,76 @@
import VTSequence from "@/components/VTSequence";
# Cursor Down (CUD)
<VTSequence sequence={["CSI", "Pn", "B"]} />
Move the cursor `n` cells down.
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.
This sequence always unsets the pending wrap state.
If the current cursor position is at or above the [bottom margin](#TODO),
the lowest point the cursor can move is the bottom margin. If the current
cursor position is below the bottom margin, the lowest point the cursor
can move is the final row.
This sequence never triggers scrolling.
## Validation
### CUD V-1: Cursor Down
```bash
printf "A"
printf "\033[2B" # cursor down
printf "X"
```
```
|A_________|
|__________|
|_Xc_______|
```
### CUD V-2: Cursor Down Above Bottom Margin
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\n\n\n\n" # screen is 4 high
printf "\033[1;3r" # set scrolling region
printf "A"
printf "\033[5B" # cursor down
printf "X"
```
```
|A_________|
|__________|
|_Xc_______|
|__________|
```
### CUD V-3: Cursor Down Below Bottom Margin
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\n\n\n\n\n" # screen is 5 high
printf "\033[1;3r" # set scrolling region
printf "A"
printf "\033[4;1H" # move below region
printf "\033[5B" # cursor down
printf "X"
```
```
|A_________|
|__________|
|__________|
|__________|
|_Xc_______|
```

View File

@ -45,6 +45,7 @@ function VTElem({ elem }: { elem: string }) {
const special: { [key: string]: number } = { const special: { [key: string]: number } = {
BEL: 0x07, BEL: 0x07,
BS: 0x08, BS: 0x08,
LF: 0x0a,
CR: 0x0d, CR: 0x0d,
ESC: 0x1b, ESC: 0x1b,
}; };