Skip to main content

Text area (chars)

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!
Experimental

Text Area Size (chars) is an XTerm window manipulation sequence that queries the character dimensions (rows and columns) of the terminal's text area.

Syntax​

CSI 18 t                     Request text area size in characters
CSI 8 ; rows ; cols t Response: character dimensions
Formal syntax
(* Request *)
text_area_chars_request  = 0x1b, "[", "1", "8", "t" ;

(* Response *)
text_area_chars_response = 0x1b, "[", "8", ";", Pn, ";", Pn, "t" ;
Pn                       = digit, { digit } ;
digit                    = "0" | "1" | "2" | "3" | "4"
                       | "5" | "6" | "7" | "8" | "9" ;

Response​

FieldDescription
rowsNumber of character rows in the text area
colsNumber of character columns in the text area

Description​

This sequence queries the terminal for the size of the text area measured in characters (rows and columns). It is part of the XTerm CSI Ps ; Ps ; Ps t window manipulation family.

When the terminal receives CSI 18 t, it responds with CSI 8 ; rows ; cols t where rows is the number of character rows and cols is the number of character columns in the text area. The response format matches the parameter format of the Resize (chars) sequence (CSI 8 ; rows ; cols t).

This report provides the same information as the TIOCGWINSZ ioctl or the COLUMNS and LINES environment variables, but it works over any transport (including serial connections and SSH tunnels) without requiring out-of-band signaling.

Applications may prefer this over the Text Area Size (pixels) report when they only need character dimensions and do not perform pixel-level operations.

Examples​

# Query text area size in characters
printf '\e[18t'

# Read the response
printf '\e[18t'; read -st 1 -d t response; echo "$response"

Specifications​

SpecificationSection
XTerm ctlseqs—

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✓YesImplemented via text_area_size_chars() at term/mod.rs:2268, responds with CSI 8 t
Bobcat✓0.9.0Requires WindowReports enabled in profile
contour✓v0.2.0.171_rc2
foot✓YesImplemented at csi.c:1356-1362, reports terminal rows and columns
Ghostty✓v1.0.0
iTerm2✓YesReturns CSI 8;height;widtht format. See VT100Terminal.m:2767-2774
Kitty✓YesReports text area size in characters via CSI 8;height;width t
Konsole✓YesReports terminal size in characters via CSI 8 t response
mintty✓YesReports terminal size in characters via CSI 18 t, implemented in src/termout.c:3046
mlterm✓rel-3_8_4
PuTTY✓0.52Implemented at terminal.c:4940-4946, reports text area size in characters via CSI 8;rows;cols t
Rio✓v0.0.28
rxvt-unicode✓1.2
st✗No
terminology✗No
VT100✗No
VTE✓Yes
WezTerm✓YesFully implemented in term/src/terminalstate/mod.rs:2025-2033
Windows Terminal✓YesImplemented as ReportTextSizeInCharacters in WindowManipulationType enum (value 18)
xterm✓xterm-406
xterm.js✓4.4.0Requires windowOptions.getWinSizeChars to be enabled
Multiplexers
cy✗NoCSI t (XTWINOPS) explicitly ignored since v0.1.0
GNU Screen✓v.5.0.0Reports window size in characters via CSI 18 t
tmux✓1.9
tuios✓v0.2.2
Zellij✓v0.10.0

See also​