From 4bbe449263a5411f1d55b4c08bfe535604e6a0d9 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 6 Oct 2023 12:47:45 -0700 Subject: [PATCH] website: cud --- website/app/vt/cud/page.mdx | 76 +++++++++++++++++++++++++++++++ website/components/VTSequence.tsx | 1 + 2 files changed, 77 insertions(+) create mode 100644 website/app/vt/cud/page.mdx diff --git a/website/app/vt/cud/page.mdx b/website/app/vt/cud/page.mdx new file mode 100644 index 000000000..10ad7d493 --- /dev/null +++ b/website/app/vt/cud/page.mdx @@ -0,0 +1,76 @@ +import VTSequence from "@/components/VTSequence"; + +# Cursor Down (CUD) + + + +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_______| +``` + diff --git a/website/components/VTSequence.tsx b/website/components/VTSequence.tsx index 7cb2c0559..471719562 100644 --- a/website/components/VTSequence.tsx +++ b/website/components/VTSequence.tsx @@ -45,6 +45,7 @@ function VTElem({ elem }: { elem: string }) { const special: { [key: string]: number } = { BEL: 0x07, BS: 0x08, + LF: 0x0a, CR: 0x0d, ESC: 0x1b, };