Skip to main content

CHT/CBT

AI-Generated Content
This page was generated with the assistance of AI and may contain inaccuracies. It is intended as a placeholder for future human verification. If you spot issues ahead of its initial review, please report them on GitHub!
Standard

CHT (Cursor Forward Tabulation) and CBT (Cursor Backward Tabulation) are CSI sequences that move the cursor forward or backward by a specified number of tab stops.

Syntax​

CSI Pn I      CHT — Cursor Forward Tabulation
CSI Pn Z CBT — Cursor Backward Tabulation
Formal syntax
CHT = 0x1b, "[", [ Pn ], "I" ;
CBT = 0x1b, "[", [ Pn ], "Z" ;
Pn  = digit, { digit } ;                (* default: 1 *)
digit = "0" | "1" | "2" | "3" | "4"
    | "5" | "6" | "7" | "8" | "9" ;

Parameters​

ParameterDescriptionDefault
PnNumber of tab stops to advance/retreat1

Description​

Per ECMA-48 §8.3.10 (CHT) and §8.3.7 (CBT):

  • CHT (CSI Pn I) — Moves the cursor to the Pn-th following tab stop. This is equivalent to pressing HT (0x09) Pn times, but expressed as a single sequence.
  • CBT (CSI Pn Z) — Moves the cursor to the Pn-th preceding tab stop.

Tab stops are set by HTS and cleared by TBC. The default tab stops are at every 8th column (1, 9, 17, 25, ...).

If there are fewer remaining tab stops than requested, the cursor moves to the last (or first, for CBT) column of the line.

Examples​

printf '\e[2I'       # Move forward 2 tab stops
printf '\e[Z' # Move backward 1 tab stop

Specifications​

SpecificationSection
ECMA-48—

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✓0.15.0CHT added in 0.15.0, CBT existed earlier (bug fix in 0.7.0)
Bobcat✓0.9.0Supported via TerminalCtrl library
contour✓v0.1.0
foot✓YesCHT (I) at csi.c:1172-1189, CBT (Z) at csi.c:1191-1204
Ghostty✓v1.0.0
iTerm2✓YesVT100CSI_CHT and ANSICSI_CBT tokens parsed and executed via terminalAppendTabAtCursor and terminalBackTab
Kitty✓YesCHT/CBT (CSI I/Z) fully implemented in vt-parser.c:1213-1216
Konsole✓YesCHT (I), CBT (Z) implemented at src/Vt102Emulation.cpp:2132,2139
mintty✓YesCHT (CSI I) at line 3179-3181, CBT (CSI Z) at line 3465-3473
mlterm✓rel-2_9_0Implemented at vt_parser.c:5639-5772
PuTTY~0.45CBT (CSI Z) supported, CHT (CSI I) not implemented
Rio✓v0.0.3
rxvt-unicode✓1.2
st✓0.1
terminology✓v0.1.0
VT100✗No
VTE✓YesFully implemented in vteseq.cc as CHT/CBT handlers
WezTerm✓YesCHT (ForwardTabulation) and CBT (BackwardTabulation) implemented as Cursor::ForwardTabulation and Cursor::BackwardTabulation
Windows Terminal✓YesImplemented in ITermDispatch.hpp:85-86 as ForwardTab (CHT) and BackwardsTab (CBT)
xterm✓xterm-406
xterm.js✓2.3.0
Multiplexers
cy✓v0.1.0
GNU Screen✓v.4.2.0
tmux✓1.6CHT not found in code; CBT (CSI Z) implemented
tuios✓v0.0.15
Zellij✓v0.9.0

See also​