csi: indicate "permanently reset" for DECRQM queries of mode 67 (DECBKM)

This allows dynamic querying for the equivalent of terminfo's "kbs"
capability.
This commit is contained in:
Craig Barnes 2024-03-15 17:51:51 +00:00 committed by Daniel Eklöf
parent f17b989650
commit 27330a5dd6
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 14 additions and 4 deletions

View file

@ -64,14 +64,16 @@
* 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`).
* `DECRQM` queries for private mode 67 ([`DECBKM`]) now reply with mode
value 4 ("permanently reset") instead of 0 ("not recognized").
* Rectangular edit functions: `DECCARA`, `DECRARA`, `DECCRA`, `DECFRA`
and `DECERA` ([#1633][1633]).
* `Rect` capability to terminfo.
[1348]: https://codeberg.org/dnkl/foot/issues/1348
[1633]: https://codeberg.org/dnkl/foot/issues/1633
[1564]: https://codeberg.org/dnkl/foot/pulls/1564
[`DECBKM`]: https://vt100.net/docs/vt510-rm/DECBKM.html
### Changed

View file

@ -428,13 +428,13 @@ mode_, `\E[?1034l`), and enabled again with `smm` (_set meta mode_,
## Backspace
Foot transmits DEL (`^?`) on <kbd>backspace</kbd>. This corresponds to
XTerm's `backarrowKey` option set to `false`, and to DECBKM being
_reset_.
XTerm's `backarrowKey` option set to `false`, and to
[`DECBKM`](https://vt100.net/docs/vt510-rm/DECBKM.html) being _reset_.
To instead transmit BS (`^H`), press
<kbd>ctrl</kbd>+<kbd>backspace</kbd>.
Note that foot does **not** implement DECBKM, and that the behavior
Note that foot does **not** implement `DECBKM`, and that the behavior
described above **cannot** be changed.
Finally, pressing <kbd>alt</kbd> will prefix the transmitted byte with

8
csi.c
View file

@ -324,6 +324,11 @@ decset_decrst(struct terminal *term, unsigned param, bool enable)
term->keypad_keys_mode = enable ? KEYPAD_APPLICATION : KEYPAD_NUMERICAL;
break;
case 67:
if (enable)
LOG_WARN("unimplemented: DECBKM");
break;
case 80:
term->sixel.scrolling = !enable;
break;
@ -555,6 +560,7 @@ decrqm(const struct terminal *term, unsigned param)
case 25: return decrpm(!term->hide_cursor);
case 45: return decrpm(term->reverse_wrap);
case 66: return decrpm(term->keypad_keys_mode == KEYPAD_APPLICATION);
case 67: return DECRPM_PERMANENTLY_RESET; /* https://vt100.net/docs/vt510-rm/DECBKM */
case 80: return decrpm(!term->sixel.scrolling);
case 1000: return decrpm(term->mouse_tracking == MOUSE_CLICK);
case 1001: return DECRPM_PERMANENTLY_RESET;
@ -600,6 +606,7 @@ xtsave(struct terminal *term, unsigned param)
case 45: term->xtsave.reverse_wrap = term->reverse_wrap; break;
case 47: term->xtsave.alt_screen = term->grid == &term->alt; break;
case 66: term->xtsave.application_keypad_keys = term->keypad_keys_mode == KEYPAD_APPLICATION; break;
case 67: break;
case 80: term->xtsave.sixel_display_mode = !term->sixel.scrolling; break;
case 1000: term->xtsave.mouse_click = term->mouse_tracking == MOUSE_CLICK; break;
case 1001: break;
@ -642,6 +649,7 @@ xtrestore(struct terminal *term, unsigned param)
case 45: enable = term->xtsave.reverse_wrap; break;
case 47: enable = term->xtsave.alt_screen; break;
case 66: enable = term->xtsave.application_keypad_keys; break;
case 67: return;
case 80: enable = term->xtsave.sixel_display_mode; break;
case 1000: enable = term->xtsave.mouse_click; break;
case 1001: return;