Skip to content

Conversation

@j4james
Copy link
Collaborator

@j4james j4james commented Jul 2, 2024

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

@j4james j4james marked this pull request as ready for review July 2, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants