Skip to content

Commit

Permalink
When using a non-US keyboard layout and pressing ctrl+key when the ke…
Browse files Browse the repository at this point in the history
…y matches an English key in the default layout, send that to the program running in the terminal automatically

See #2000
  • Loading branch information
kovidgoyal committed Jan 17, 2021
1 parent 2cbbd84 commit d45d553
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
7 changes: 7 additions & 0 deletions kitty/key_encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit d45d553

Please sign in to comment.