Cursor Horizontal Tabulation (CHT)
Move the cursor right `n` tabs.
- 0x1B
- ESC
- 0x5B
- [
- ____
- n
- 0x49
- I
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.
The rightmost valid column for this operation is the rightmost column in the terminal screen or the right margin, whichever is smaller. This sequence does not change behavior with origin mode set.
Move the cursor right until the cursor position is on a tabstop. If the
cursor would move past the rightmost valid column, the cursor remains at
the rightmost 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), tab clear (TBC), etc. A terminal emulator may default tabstops at any interval, though an interval of 8 spaces is most common.
printf "\033[?5W" # reset tab stops
printf "\033[100I" # assuming the test terminal has less than 800 columns
printf "A"
|_________A|
printf "\033[?5W" # reset tab stops
printf "\033[1;2H"
printf "A"
printf "\033[I"
printf "X"
|_A______X_|
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?5W" # reset tab stops
printf "\033[?69h" # enable left/right margins
printf "\033[3;6s" # scroll region left/right
printf "\033[1;1H" # move cursor in region
printf "X"
printf "\033[I"
printf "A"
|__AX______|