Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for querying the character cell size #17504

Merged
merged 2 commits into from
Jul 2, 2024

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
@zadjii-msft zadjii-msft added this pull request to the merge queue Jul 2, 2024
Merged via the queue into microsoft:main with commit 61ee7b0 Jul 2, 2024
15 checks passed
@j4james j4james deleted the feature-cellsize-query branch August 3, 2024 15:43
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