diff --git a/website/app/vt/ich/page.mdx b/website/app/vt/ich/page.mdx new file mode 100644 index 000000000..40a520cf0 --- /dev/null +++ b/website/app/vt/ich/page.mdx @@ -0,0 +1,103 @@ +import VTSequence from "@/components/VTSequence"; + +# Insert Character (ICH) + + + +Insert `n` blank characters at the current cursor position and shift +existing cell contents right. + +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 cursor position is outside of the [left and right margins](#TODO), +this sequence does not change the screen, but the pending wrap state is +still reset. + +Existing cells shifted beyond the right margin are deleted. Inserted cells +are blank with the background color colored according to the current SGR state. + +## Validation + +### ICH V-1: No Scroll Region, Fits on Screen + +```bash +printf "ABC" +printf "\033[1G" +printf "\033[2@" +``` + +``` +|XcABC_____| +``` + +### ICH V-2: SGR State + +```bash +printf "ABC" +printf "\033[1G" +printf "\033[41m" +printf "\033[2@" +printf "X" +``` + +``` +|c_ABC_____| +``` + +The `c_` cells should both have a red background. The `ABC` cells should +remain unchanged in style. + +### ICH V-3: Shifting Content Off the Screen + +```bash +cols=$(tput cols) +printf "\033[${cols}G" +printf "\033[2D" +printf "ABC" +printf "\033[2D" +printf "\033[2@" +printf "X" +``` + +``` +|_______XcA| +``` + +### ICH V-4: Inside Left/Right Scroll Region + +```bash +printf "\033[1;1H" # move to top-left +printf "\033[0J" # clear screen +printf "\033[?69h" # enable left/right margins +printf "\033[3;5s" # scroll region left/right +printf "\033[3G" +printf "ABC" +printf "\033[3G" +printf "\033[2@" +printf "X" +``` + +``` +|__XcA_____| +``` + +### ICH V-5: Outside Left/Right Scroll Region + +```bash +printf "\033[1;1H" # move to top-left +printf "\033[0J" # clear screen +printf "\033[?69h" # enable left/right margins +printf "\033[3;5s" # scroll region left/right +printf "\033[3G" +printf "ABC" +printf "\033[1G" +printf "\033[2@" +printf "X" +``` + +``` +|XcABC_____| +```