website: start cr

This commit is contained in:
Mitchell Hashimoto
2023-10-06 11:24:28 -07:00
parent 65225cca13
commit 944a879ecb
3 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,36 @@
import VTSequence from "@/components/VTSequence";
# Carriage Return (CR)
<VTSequence sequence="CR" />
Move the cursor to the leftmost column.
This sequence always unsets the pending wrap state.
If [origin mode (mode 6)](#TODO) is enabled, the cursor is set to the
[left margin](#TODO) of the scroll region and the operation is complete.
If origin mode is _not_ set and the cursor is on or to the right of the
left margin, the cursor is set to the left margin. If the cursor is to the left
of the left margin, the cursor is moved to the leftmost column in the terminal.
## Validation
### CR V-1: Pending Wrap is Unset
```bash
cols=$(tput cols)
printf "\033[${cols}G" # move to last column
printf "A" # set pending wrap state
printf "\r"
printf "X"
echo
```
```
|X________A|
|c_________|
```
### TODO: left/right margins

View File

@ -143,3 +143,4 @@ printf "X"
|B_________| |B_________|
|_________Xc |_________Xc
``g ``g
```

View File

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