aboutsummaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorCraig Barnes <craigbarnes@protonmail.com>2020-11-29 04:04:57 +0000
committerCraig Barnes <craigbarnes@protonmail.com>2020-11-29 04:04:57 +0000
commit31c73f0cf01e1d0bdcd1435136b010c1c1ab442c (patch)
tree7ac39efb8f426cc1edb613405d11d2b1f69a2042 /input.c
parentkeymap: add ‘CSI 27;<mod>;27~’ escapes for Esc with modifiers (diff)
csi: add new private mode that makes the Escape key emit "\E[27;1;27~"
This mode can be set by client programs with the DECSET, DECRST, XTSAVE and XTRESTORE sequences by using 27127 as the parameter. The sequence "\E[27;1;27~" is encoded in the same way as is done by xterm's "modifyOtherKeys" mode. Even though xterm itself never emits such a sequence for the Escape key, many programs already have support for parsing this style of key sequence.
Diffstat (limited to 'input.c')
-rw-r--r--input.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/input.c b/input.c
index 61f1d004..191a3de9 100644
--- a/input.c
+++ b/input.c
@@ -891,7 +891,13 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
keymap_mods |= seat->kbd.ctrl ? MOD_CTRL : MOD_NONE;
keymap_mods |= seat->kbd.meta ? MOD_META : MOD_NONE;
- const struct key_data *keymap = keymap_lookup(seat, term, sym, keymap_mods);
+ const struct key_data *keymap;
+ if (sym == XKB_KEY_Escape && keymap_mods == MOD_NONE && term->modify_escape_key) {
+ static const struct key_data esc = {.seq = "\033[27;1;27~"};
+ keymap = &esc;
+ } else
+ keymap = keymap_lookup(seat, term, sym, keymap_mods);
+
if (keymap != NULL) {
term_to_slave(term, keymap->seq, strlen(keymap->seq));