From 4a740509996d3a7e8808593d1cbc0128b1ae03ed Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 11 Nov 2021 17:43:39 +0100 Subject: input: add support for modifyOtherKeys=2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Similar to modifyOtherKeys=1 (foot’s default, and only, mode), except that: * All modifiers (and not just Ctrl) generate \E[27;m;n~ escapes * Regular keys (with modifiers) also generate \E[27;m;n~ escapes (for example, C-h no longer generates ^H, but \E[27;5;104~) For our keymap based lookups, this is handled by adding MOD_MODIFY_OTHER_KEYS_STATE variants. For “generic” keys, we simply adjust the conditions for when to emit a \E[27;m;n~ escape - the only requirement is that at least one modifier is active. --- csi.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'csi.c') diff --git a/csi.c b/csi.c index 4a9658f3..becfc142 100644 --- a/csi.c +++ b/csi.c @@ -1509,19 +1509,21 @@ csi_dispatch(struct terminal *term, uint8_t final) case 1: /* modifyCursorKeys */ case 2: /* modifyFunctionKeys */ - case 4: /* modifyOtherKeys */ /* Ignored, we always report modifiers */ - if (value != 2 && value != -1 && - !(resource == 4 && value == 1)) - { - LOG_WARN("unimplemented: %s = %d", - resource == 1 ? "modifyCursorKeys" : - resource == 2 ? "modifyFunctionKeys" : - resource == 4 ? "modifyOtherKeys" : "", - value); + if (value != 2 && value != -1) { + LOG_WARN( + "unimplemented: %s = %d", + resource == 1 ? "modifyCursorKeys" : + resource == 2 ? "modifyFunctionKeys" : "", + value); } break; + case 4: /* modifyOtherKeys */ + term->modify_other_keys_2 = value == 2; + LOG_DBG("modifyOtherKeys=%d", value); + break; + default: LOG_WARN("invalid resource %d in %s", resource, csi_as_string(term, final, -1)); -- cgit v1.3