diff --git a/website/app/vt/cr/page.mdx b/website/app/vt/cr/page.mdx new file mode 100644 index 000000000..1a00b2710 --- /dev/null +++ b/website/app/vt/cr/page.mdx @@ -0,0 +1,36 @@ +import VTSequence from "@/components/VTSequence"; + +# Carriage Return (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 diff --git a/website/app/vt/cub/page.mdx b/website/app/vt/cub/page.mdx index d7e8dca57..4b252bdec 100644 --- a/website/app/vt/cub/page.mdx +++ b/website/app/vt/cub/page.mdx @@ -143,3 +143,4 @@ printf "X" |B_________| |_________Xc ``g +``` diff --git a/website/components/VTSequence.tsx b/website/components/VTSequence.tsx index bf3e94d7c..7cb2c0559 100644 --- a/website/components/VTSequence.tsx +++ b/website/components/VTSequence.tsx @@ -45,5 +45,6 @@ function VTElem({ elem }: { elem: string }) { const special: { [key: string]: number } = { BEL: 0x07, BS: 0x08, + CR: 0x0d, ESC: 0x1b, };