Add support for querying the character cell size #17504
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 dividedby 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 usesCSI 14 t
).PR Checklist