Cursor Backward Tabulation (CBT)
Move the cursor `n` tabs left.
- 0x1B
- ESC
- 0x5B
- [
- ____
- n
- 0x5A
- Z
The leftmost valid column for this operation is the first column. If origin mode is enabled, then the leftmost valid column for this operation is the left margin.
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), 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[10Z"
printf "A"
|Ac________|
printf "\033[?5W" # reset tab stops
printf "\033[1;10H"
printf "X"
printf "\033[Z"
printf "A"
|________AX|
printf "\033[?5W" # reset tab stops
printf "\033[1;9H"
printf "X"
printf "\033[1;9H"
printf "\033[Z"
printf "A"
|A_______X_|
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?5W" # 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______|