When using a non-US keyboard layout and pressing ctrl+key when the key matches an English key in the default layout, send that to the program running in the terminal automatically

See #2000
This commit is contained in:
Kovid Goyal 2021-01-17 08:25:19 +05:30
parent 2cbbd84987
commit d45d553eaf
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 11 additions and 0 deletions

View File

@ -7,6 +7,10 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.20.0 [future]
----------------------
- When using a non-US keyboard layout and pressing :kbd:`ctrl+key` when
the key matches an English key, send that to the program running in the
terminal automatically (:iss:`2000`)
- Add support for the color settings stack that XTerm copied from us without
acknowledgement and decided to use incompatible escape codes for.

View File

@ -374,6 +374,13 @@ encode_key(const KeyEvent *ev, char *output) {
output[0] = 0;
return 1;
}
if ((ev->mods.value == CTRL || ev->mods.value == ALT || ev->mods.value == (CTRL | ALT)) && ev->alternate_key && !is_legacy_ascii_key(ev->key) && is_legacy_ascii_key(ev->alternate_key)) {
KeyEvent alternate = *ev;
alternate.key = ev->alternate_key;
alternate.alternate_key = 0;
int ret = encode_printable_ascii_key_legacy(&alternate, output);
if (ret > 0) return ret;
}
}
}