From 73c079e07fa3738687c06e64a4c1c33b1c179554 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 6 Oct 2023 15:48:30 -0700 Subject: [PATCH] website: cbt --- website/app/vt/cbt/page.mdx | 83 +++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 website/app/vt/cbt/page.mdx diff --git a/website/app/vt/cbt/page.mdx b/website/app/vt/cbt/page.mdx new file mode 100644 index 000000000..9c17e3736 --- /dev/null +++ b/website/app/vt/cbt/page.mdx @@ -0,0 +1,83 @@ +import VTSequence from "@/components/VTSequence"; + +# Cursor Backward Tabulation (CBT) + + + +Move the cursor `n` tabs left. + +The leftmost valid column for this operation is the first column. If +[origin mode](#TODO) is enabled, then the leftmost valid column for this +operatin is the [left margin](#TODO). + +Move the cursor left until the cursor position is on a tabstop. If the +cursor would move past the leftmost valid column, the cursor remains at +the leftmost valid column and the operation completes. Repeat this process +`n` times. + +Tabstops are dynamic and can be set with escape sequences such as +[horizontal tab set (HTS)](/vt/hts), [tab clear (TBC)](/vt/tbc), etc. +A terminal emulator may default tabstops at any interval, though an interval +of 8 spaces is most common. + +## Validation + +### CBT V-1: Left Beyond First Column + +```bash +printf "\033[?W" # reset tab stops +printf "\033[10Z" +printf "A" +``` + +``` +|Ac________| +``` + +### CBT V-2: Left Beyond First Column + +```bash +printf "\033[?W" # reset tab stops +printf "\033[1;10" +printf "X" +printf "\033[Z" +printf "A" +``` + +``` +|________AX| +``` + +### CBT V-3: Left Starting on Tabstop + +```bash +printf "\033[?W" # reset tab stops +printf "\033[1;9H" +printf "X" +printf "\033[1;9H" +printf "\033[Z" +printf "A" +``` + +``` +|A_______X_| +``` + +### CBT V-4: Left Margin with Origin Mode + +```bash +printf "\033[1;1H" # move to top-left +printf "\033[0J" # clear screen +printf "\033[?W" # reset tab stops +printf "\033[?6h" # enable origin mode +printf "\033[?69h" # enable left/right margins +printf "\033[3;6s" # scroll region left/right +printf "\033[1;2H" # move cursor in region +printf "X" +printf "\033[Z" +printf "A" +``` + +``` +|__AX______| +```