From 40c338ac02b5999c79fc06b7d485a7621ac93a01 Mon Sep 17 00:00:00 2001 From: cy384 Date: Fri, 2 Apr 2021 23:16:58 -0400 Subject: [PATCH] handle option/alt key combos --- ssheven.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ssheven.c b/ssheven.c index 29b5bdf..0482bf4 100644 --- a/ssheven.c +++ b/ssheven.c @@ -515,10 +515,25 @@ int handle_keypress(EventRecord* event) // note that this is after translation, e.g. shift-f -> 'F' else if (c) { + // TODO this sucks + // manually send an escape if we have alt option held + if (event->modifiers & optionKey) + { + ssh_con.send_buffer[0] = '\e'; + ssh_write(ssh_con.send_buffer, 1); + } + if (key_to_vterm[c] != VTERM_KEY_NONE) { + // doesn't seem like vterm does modifiers properly vterm_keyboard_key(con.vterm, key_to_vterm[c], VTERM_MOD_NONE); } + else if (event->modifiers & optionKey) + { + int unmodified_key = KeyTranslate((void*)GetScriptManagerVariable(smKCHRCache), (event->message & keyCodeMask)>>8, 0); + ssh_con.send_buffer[0] = unmodified_key & 0xff; + ssh_write(ssh_con.send_buffer, 1); + } else { ssh_con.send_buffer[0] = c;