Cell size
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
Cell Size is an XTerm window manipulation sequence that queries the pixel dimensions of an individual character cell in the terminal.
Syntax
CSI 16 t Request cell size in pixels
CSI 6 ; height ; width t Response: cell pixel dimensions
Formal syntax
(* Request *)
cell_size_request = 0x1b, "[", "1", "6", "t" ;
(* Response *)
cell_size_response = 0x1b, "[", "6", ";", Pn, ";", Pn, "t" ;
Pn = digit, { digit } ;
digit = "0" | "1" | "2" | "3" | "4"
| "5" | "6" | "7" | "8" | "9" ;Response
| Field | Description |
|---|---|
height | Height of a single character cell in pixels |
width | Width of a single character cell in pixels |
Description
This sequence queries the terminal for the pixel dimensions of a single character cell. It is part of the XTerm CSI Ps ; Ps ; Ps t window manipulation family.
When the terminal receives CSI 16 t, it responds with CSI 6 ; height ; width t where height and width are the pixel dimensions of a single character cell. The cell size is determined by the current font and its rendering configuration.
Typical cell sizes for common monospace fonts are in the range of 7-10 pixels wide by 14-20 pixels tall, though high-DPI displays and font scaling can produce larger values.
The cell size report is particularly useful for:
- Graphics protocols: Applications that render inline graphics (such as Sixel or Kitty Graphics) need the cell size to correctly scale images to align with the character grid.
- Size calculations: Dividing the Text Area Size (pixels) by the cell size yields the text area dimensions in characters.
- Mouse position mapping: Converting pixel-based mouse coordinates to character cell positions.
Examples
# Query cell size
printf '\e[16t'
# Read the response
printf '\e[16t'; read -st 1 -d t response; echo "$response"
Specifications
| Specification | Section |
|---|---|
| XTerm ctlseqs | — |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ✗ | No | Explicitly rejected - CSI 16 t not in supported list (escape_support.md line 81-82) |
| Bobcat | ✓ | 0.9.0 | Requires WindowReports enabled in profile |
| contour | ✓ | v0.1.0 | |
| foot | ✓ | Yes | Implemented at csi.c:1347-1354, reports cell height and width in pixels |
| Ghostty | ✓ | v1.0.0 | |
| iTerm2 | ✗ | No | Not implemented. Parser explicitly marks Ps=16 as VT100_NOTSUPPORT. Delegate method terminalCellSizeInPoints exists but is not connected to this sequence. |
| Kitty | ✓ | Yes | Reports cell size in pixels via CSI 6;height;width t |
| Konsole | ✓ | Yes | Reports cell size in pixels via CSI 6 t response |
| mintty | ✓ | Yes | Reports cell dimensions via CSI 16 t, implemented in src/termout.c:3045 |
| mlterm | ✓ | rel-3_8_6 | |
| PuTTY | ✗ | No | Not implemented; CSI t handler only includes cases 1-21 (excluding 10,12,15,16,17) |
| Rio | ✓ | v0.1.11 | |
| rxvt-unicode | ✗ | No | Not implemented; fwidth/fheight available internally but no CSI 16 t handler |
| st | ✗ | No | |
| terminology | ✗ | No | |
| VT100 | ✗ | No | |
| VTE | ✗ | No | CSI 16 t not implemented; VTE skips from operation 14 to 18 in XTERM_WM enum |
| WezTerm | ✓ | Yes | Fully implemented in term/src/terminalstate/mod.rs:2035-2045 |
| Windows Terminal | ✓ | Yes | Implemented as ReportCharacterCellSize in WindowManipulationType enum (value 16) |
| xterm | ✓ | xterm-406 | Requires OPT_MAXIMIZE compile flag (enabled by default) |
| xterm.js | ✓ | 4.4.0 | Requires windowOptions.getCellSizePixels to be enabled |
| Multiplexers | |||
| cy | ✗ | No | CSI t (XTWINOPS) explicitly ignored since v0.1.0 |
| GNU Screen | ✗ | No | CSI 16 t not implemented; only CSI 7/8/11/18/21 t are handled |
| tmux | ✓ | 3.4 | Reports cell size in pixels via w->xpixel and w->ypixel |
| tuios | ✓ | v0.2.2 | |
| Zellij | ✓ | v0.28.0 | |
See also
- Text Area Size (pixels) — Query text area pixel dimensions
- Text Area Size (chars) — Query text area character dimensions
- Resize (pixels) — Resize to specific pixel dimensions
- Resize (chars) — Resize to specific character dimensions