csi: support DECRQM queries for ECMA-48 (SM/RM) modes

This is in addition to the existing support for DECRQM queries
of DEC private modes.
This commit is contained in:
Craig Barnes 2024-02-11 15:09:28 +00:00
parent 9d9690410a
commit fa01bf2b75
3 changed files with 30 additions and 5 deletions

View file

@ -61,6 +61,7 @@
* `pipe-command-output` key binding.
* Support for OSC-176, _"Set App-ID"_
(https://gist.github.com/delthas/d451e2cc1573bb2364839849c7117239).
* Support for `DECRQM` queries with ANSI/ECMA-48 modes (`CSI Ps $ p`).
[1348]: https://codeberg.org/dnkl/foot/issues/1348

17
csi.c
View file

@ -1429,6 +1429,23 @@ csi_dispatch(struct terminal *term, uint8_t final)
break;
}
case 'p': {
/*
* Request status of ECMA-48/"ANSI" private mode (DECRQM
* for SM/RM modes; see private="?$" case further below for
* DECSET/DECRST modes)
*/
unsigned param = vt_param_get(term, 0, 0);
unsigned status = DECRPM_NOT_RECOGNIZED;
if (param == 4) {
status = decrpm(term->insert_mode);
}
char reply[32];
size_t n = xsnprintf(reply, sizeof(reply), "\033[%u;%u$y", param, status);
term_to_slave(term, reply, n);
break;
}
case 'u': {
enum kitty_kbd_flags flags =
term->grid->kitty_kbd.flags[term->grid->kitty_kbd.idx];

View file

@ -443,13 +443,13 @@ manipulation sequences. The generic format is:
| \\E[ _Pm_ h
: SM
: VT100
: Set mode. _Pm_=4 -> enable IRM (insert mode). All other values of
_Pm_ are unsupported.
: Set mode. _Pm_=4 -> enable IRM (Insertion Replacement Mode). All
other values of _Pm_ are unsupported.
| \\E[ _Pm_ l
: RM
: VT100
: Reset mode. _Pm_=4 -> disable IRM (insert mode). All other values of
_Pm_ are unsupported.
: Reset mode. _Pm_=4 -> disable IRM (Insertion Replacement Mode). All
other values of _Pm_ are unsupported.
| \\E[ _Ps_ n
: DSR
: VT100
@ -487,7 +487,14 @@ manipulation sequences. The generic format is:
| \\E[ ? _Ps_ $ p
: DECRQM
: VT320
: Request DEC private mode.
: Request status of DEC private mode. The _Ps_ parameter corresponds
to one of the values mentioned in the "Private Modes" section above
(as set with DECSET/DECRST).
| \\E[ _Ps_ $ p
: DECRQM
: VT320
: Request status of ECMA-48/ANSI mode. See the descriptions for SM/RM
above for recognized _Ps_ values.
| \\E[ _Ps_ T
: SD
: VT420