[PR #17504] Add support for querying the character cell size #31247

Closed
opened 2026-01-31 09:46:04 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/17504

State: closed
Merged: Yes


This PR add supports for two query sequences that are used to determine
the pixel size of a character cell:

  • CSI 16 t reports the pixel size of a character cell directly.
  • CSI 14 t reports the pixel size of the text area, and when divided
    by the character size of the text area, you can get the character cell
    size indirectly (this method predates the introduction of CSI 16 t).

These queries are used by Sixel applications that want to fit an image
within specific text boundaries, so need to know how many cells would be
covered by a particular pixel size, or vice versa. Our implementation of
Sixel uses a virtual cell size that is always 10x20 (in order to emulate
the VT340 more accurately), so these queries shouldn't really be needed,
but some applications will fail to work without them.

References and Relevant Issues

Sixel support was added to conhost in PR #17421.

Validation Steps Performed

I've added some unit tests to verify that these queries are producing
the expected responses, and I've manually tested on XtermDOOM (which
uses CSI 16 t), and the Notcurses library (which uses CSI 14 t).

PR Checklist

  • Tests added/passed
**Original Pull Request:** https://github.com/microsoft/terminal/pull/17504 **State:** closed **Merged:** Yes --- This PR add supports for two query sequences that are used to determine the pixel size of a character cell: * `CSI 16 t` reports the pixel size of a character cell directly. * `CSI 14 t` reports the pixel size of the text area, and when divided by the character size of the text area, you can get the character cell size indirectly (this method predates the introduction of `CSI 16 t`). These queries are used by Sixel applications that want to fit an image within specific text boundaries, so need to know how many cells would be covered by a particular pixel size, or vice versa. Our implementation of Sixel uses a virtual cell size that is always 10x20 (in order to emulate the VT340 more accurately), so these queries shouldn't really be needed, but some applications will fail to work without them. ## References and Relevant Issues Sixel support was added to conhost in PR #17421. ## Validation Steps Performed I've added some unit tests to verify that these queries are producing the expected responses, and I've manually tested on [XtermDOOM] (which uses `CSI 16 t`), and the [Notcurses] library (which uses `CSI 14 t`). [XtermDOOM]: https://gitlab.com/AutumnMeowMeow/xtermdoom [Notcurses]: https://github.com/dankamongmen/notcurses ## PR Checklist - [x] Tests added/passed
claunia added the pull-request label 2026-01-31 09:46:04 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31247