Commit 61ee7b0
authored
Add support for querying the character cell size (#17504)
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/passed1 parent ee40166 commit 61ee7b0
File tree
6 files changed
+43
-8
lines changed- src/terminal/adapter
- ut_adapter
6 files changed
+43
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
| 592 | + | |
| 593 | + | |
592 | 594 | | |
593 | 595 | | |
594 | 596 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3648 | 3648 | | |
3649 | 3649 | | |
3650 | 3650 | | |
| 3651 | + | |
| 3652 | + | |
| 3653 | + | |
| 3654 | + | |
| 3655 | + | |
| 3656 | + | |
3651 | 3657 | | |
3652 | 3658 | | |
3653 | 3659 | | |
| |||
3663 | 3669 | | |
3664 | 3670 | | |
3665 | 3671 | | |
3666 | | - | |
3667 | | - | |
3668 | | - | |
| 3672 | + | |
| 3673 | + | |
| 3674 | + | |
| 3675 | + | |
| 3676 | + | |
| 3677 | + | |
| 3678 | + | |
| 3679 | + | |
| 3680 | + | |
| 3681 | + | |
| 3682 | + | |
| 3683 | + | |
3669 | 3684 | | |
3670 | | - | |
3671 | 3685 | | |
3672 | 3686 | | |
3673 | 3687 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3377 | 3377 | | |
3378 | 3378 | | |
3379 | 3379 | | |
| 3380 | + | |
| 3381 | + | |
| 3382 | + | |
| 3383 | + | |
3380 | 3384 | | |
3381 | | - | |
3382 | 3385 | | |
3383 | | - | |
| 3386 | + | |
| 3387 | + | |
| 3388 | + | |
| 3389 | + | |
| 3390 | + | |
| 3391 | + | |
| 3392 | + | |
| 3393 | + | |
| 3394 | + | |
| 3395 | + | |
| 3396 | + | |
3384 | 3397 | | |
3385 | 3398 | | |
3386 | 3399 | | |
| |||
0 commit comments