website: ind

This commit is contained in:
Mitchell Hashimoto
2023-10-06 14:27:51 -07:00
parent eeecc6c7e7
commit 139d8ea208
3 changed files with 126 additions and 1 deletions

View File

@ -73,4 +73,3 @@ printf "X"
|__________| |__________|
|_Xc_______| |_Xc_______|
``` ```

117
website/app/vt/ind/page.mdx Normal file
View File

@ -0,0 +1,117 @@
import VTSequence from "@/components/VTSequence";
# Index (IND)
<VTSequence sequence={["ESC", "D"]} />
Move the cursor down one cell, scrolling if necessary.
This sequence always unsets the pending wrap state.
If the cursor is exactly on the bottom margin and is at or within the
[left](#TODO) and [right margin](#TODO), [scroll up](#TODO) one line.
If the scroll region is the full terminal screen and the terminal is on
the [primary screen](#TODO), this may create scrollback. See the
[scroll](#TODO) documentation for more details.
If the cursor is outside of the scroll region or not on the bottom
margin of the scroll region, perform the [cursor down](/vt/cud) operation with
`n = 1`.
This sequence will only scroll when the cursor is exactly on the bottom
margin and within the remaining scroll region. If the cursor is outside
the scroll region and on the bottom line of the terminal, the cursor
does not move.
## Validation
### IND V-1: No Scroll Region, Top of Screen
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "A"
printf "\033D" # index
printf "X"
```
```
|A_________|
|_Xc_______|
```
### IND V-2: Bottom of Primary Screen
```bash
lines=$(tput lines)
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[${lines};1H" # move to bottom-left
printf "A"
printf "\033D" # index
printf "X"
```
```
|A_________|
|_Xc_______|
```
### IND V-3: Inside Scroll Region
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[1;3r" # scroll region
printf "A"
printf "\033D" # index
printf "X"
```
```
|A_________|
|_Xc_______|
```
### IND V-4: Bottom of Scroll Region
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[1;3r" # scroll region
printf "\033[4;1H" # below scroll region
printf "B"
printf "\033[3;1H" # move to last row of region
printf "A"
printf "\033D" # index
printf "X"
```
```
|__________|
|A_________|
|_Xc_______|
|B_________|
```
### IND V-5: Bottom of Primary Screen with Scroll Region
```bash
lines=$(tput lines)
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[1;3r" # scroll region
printf "\033[3;1H" # move to last row of region
printf "A"
printf "\033[${lines};1H" # move to bottom-left
printf "\033D" # index
printf "X"
```
```
|__________|
|__________|
|A_________|
|__________|
|Xc________|
```

View File

@ -0,0 +1,9 @@
import VTSequence from "@/components/VTSequence";
# Linefeed (LF)
<VTSequence sequence="LF" />
This is an alias for [index (IND)](/vt/ind).
TODO: linefeed mode