From 139d8ea2080c999fe9125b1bc4f8b7acf4c58335 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 6 Oct 2023 14:27:51 -0700 Subject: [PATCH] website: ind --- website/app/vt/cud/page.mdx | 1 - website/app/vt/ind/page.mdx | 117 ++++++++++++++++++++++++++++++++++++ website/app/vt/lf/page.mdx | 9 +++ 3 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 website/app/vt/ind/page.mdx create mode 100644 website/app/vt/lf/page.mdx diff --git a/website/app/vt/cud/page.mdx b/website/app/vt/cud/page.mdx index 10ad7d493..63c51c562 100644 --- a/website/app/vt/cud/page.mdx +++ b/website/app/vt/cud/page.mdx @@ -73,4 +73,3 @@ printf "X" |__________| |_Xc_______| ``` - diff --git a/website/app/vt/ind/page.mdx b/website/app/vt/ind/page.mdx new file mode 100644 index 000000000..621295abd --- /dev/null +++ b/website/app/vt/ind/page.mdx @@ -0,0 +1,117 @@ +import VTSequence from "@/components/VTSequence"; + +# Index (IND) + + + +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________| +``` diff --git a/website/app/vt/lf/page.mdx b/website/app/vt/lf/page.mdx new file mode 100644 index 000000000..10ac27bbb --- /dev/null +++ b/website/app/vt/lf/page.mdx @@ -0,0 +1,9 @@ +import VTSequence from "@/components/VTSequence"; + +# Linefeed (LF) + + + +This is an alias for [index (IND)](/vt/ind). + +TODO: linefeed mode