aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Barnes <craigbarnes@protonmail.com>2024-02-11 15:09:28 +0000
committerCraig Barnes <craigbarnes@protonmail.com>2024-02-11 15:09:28 +0000
commitfa01bf2b75fd5c74c57552cb351cb291002fc3bb (patch)
tree90f446241a9c152b5ce83c3d878df4cf46135a79
parentpgo: render_resize_force() has been removed, adjust stub accordingly (diff)
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.
-rw-r--r--CHANGELOG.md1
-rw-r--r--csi.c17
-rw-r--r--doc/foot-ctlseqs.7.scd17
3 files changed, 30 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b2e4a62d..a11e2b5b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/csi.c b/csi.c
index fe783b13..78fdf4ef 100644
--- a/csi.c
+++ b/csi.c
@@ -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];
diff --git a/doc/foot-ctlseqs.7.scd b/doc/foot-ctlseqs.7.scd
index 64c56d5d..0d8d5d79 100644
--- a/doc/foot-ctlseqs.7.scd
+++ b/doc/foot-ctlseqs.7.scd
@@ -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