Text area (chars)
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
(* 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
| Field | Description |
|---|---|
rows | Number of character rows in the text area |
cols | Number 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
| Specification | Section |
|---|---|
| XTerm ctlseqs | — |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ✓ | Yes | Implemented via text_area_size_chars() at term/mod.rs:2268, responds with CSI 8 t |
| Bobcat | ✓ | 0.9.0 | Requires WindowReports enabled in profile |
| contour | ✓ | v0.2.0.171_rc2 | |
| foot | ✓ | Yes | Implemented at csi.c:1356-1362, reports terminal rows and columns |
| Ghostty | ✓ | v1.0.0 | |
| iTerm2 | ✓ | Yes | Returns CSI 8;height;widtht format. See VT100Terminal.m:2767-2774 |
| Kitty | ✓ | Yes | Reports text area size in characters via CSI 8;height;width t |
| Konsole | ✓ | Yes | Reports terminal size in characters via CSI 8 t response |
| mintty | ✓ | Yes | Reports terminal size in characters via CSI 18 t, implemented in src/termout.c:3046 |
| mlterm | ✓ | rel-3_8_4 | |
| PuTTY | ✓ | 0.52 | Implemented 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 | ✓ | Yes | Fully implemented in term/src/terminalstate/mod.rs:2025-2033 |
| Windows Terminal | ✓ | Yes | Implemented as ReportTextSizeInCharacters in WindowManipulationType enum (value 18) |
| xterm | ✓ | xterm-406 | |
| xterm.js | ✓ | 4.4.0 | Requires windowOptions.getWinSizeChars to be enabled |
| Multiplexers | |||
| cy | ✗ | No | CSI t (XTWINOPS) explicitly ignored since v0.1.0 |
| GNU Screen | ✓ | v.5.0.0 | Reports window size in characters via CSI 18 t |
| tmux | ✓ | 1.9 | |
| tuios | ✓ | v0.2.2 | |
| Zellij | ✓ | v0.10.0 | |
See also
- Resize (chars) — Resize to specific character dimensions
- Text Area Size (pixels) — Query text area pixel dimensions
- Cell Size — Query individual cell pixel dimensions
- DSR/CPR — Device Status Report — Query cursor position