Fix a regression in 0.20.0 that sent incorrect bytes for the F1-F4 keys in rmkx mode

Fixes #3586
This commit is contained in:
Kovid Goyal 2021-05-07 15:09:42 +05:30
parent dbf8580dc3
commit efb0f6f24a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 16 additions and 4 deletions

View File

@ -12,6 +12,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Unicode input kitten: Fix a regression in 0.20.0 that broke keyboard handling - Unicode input kitten: Fix a regression in 0.20.0 that broke keyboard handling
when the num lock or caps lock modifiers were engaged. (:iss:`3587`) when the num lock or caps lock modifiers were engaged. (:iss:`3587`)
- Fix a regression in 0.20.0 that sent incorrect bytes for the :kbd:`F1-F4` keys
in rmkx mode (:iss:`3586`)
0.20.3 [2021-05-06] 0.20.3 [2021-05-06]
---------------------- ----------------------

View File

@ -185,6 +185,15 @@ encode_function_key(const KeyEvent *ev, char *output) {
} }
if (!ev->mods.value) { if (!ev->mods.value) {
if (!ev->disambiguate && !ev->report_text && key_number == GLFW_FKEY_ESCAPE) SIMPLE("\x1b"); if (!ev->disambiguate && !ev->report_text && key_number == GLFW_FKEY_ESCAPE) SIMPLE("\x1b");
if (legacy_mode) {
switch(key_number) {
case GLFW_FKEY_F1: SIMPLE("\x1bOP");
case GLFW_FKEY_F2: SIMPLE("\x1bOQ");
case GLFW_FKEY_F3: SIMPLE("\x1bOR");
case GLFW_FKEY_F4: SIMPLE("\x1bOS");
default: break;
}
}
if (!ev->report_text) { if (!ev->report_text) {
switch(key_number) { switch(key_number) {
case GLFW_FKEY_ENTER: SIMPLE("\r"); case GLFW_FKEY_ENTER: SIMPLE("\r");

View File

@ -91,10 +91,10 @@ class TestKeys(BaseTest):
mkp('PAGE_DOWN', csi_num=6, trailer='~') mkp('PAGE_DOWN', csi_num=6, trailer='~')
mkp('HOME', csi_num=1, trailer='H') mkp('HOME', csi_num=1, trailer='H')
mkp('END', csi_num=1, trailer='F') mkp('END', csi_num=1, trailer='F')
mods_test(defines.GLFW_FKEY_F1, csi_num=1, trailer='P') mods_test(defines.GLFW_FKEY_F1, '\x1bOP', csi_num=1, trailer='P')
mods_test(defines.GLFW_FKEY_F2, csi_num=1, trailer='Q') mods_test(defines.GLFW_FKEY_F2, '\x1bOQ', csi_num=1, trailer='Q')
mods_test(defines.GLFW_FKEY_F3, csi_num=1, trailer='R') mods_test(defines.GLFW_FKEY_F3, '\x1bOR', csi_num=1, trailer='R')
mods_test(defines.GLFW_FKEY_F4, csi_num=1, trailer='S') mods_test(defines.GLFW_FKEY_F4, '\x1bOS', csi_num=1, trailer='S')
mods_test(defines.GLFW_FKEY_F5, csi_num=15, trailer='~') mods_test(defines.GLFW_FKEY_F5, csi_num=15, trailer='~')
mods_test(defines.GLFW_FKEY_F6, csi_num=17, trailer='~') mods_test(defines.GLFW_FKEY_F6, csi_num=17, trailer='~')
mods_test(defines.GLFW_FKEY_F7, csi_num=18, trailer='~') mods_test(defines.GLFW_FKEY_F7, csi_num=18, trailer='~')