From 7332561d8e432026e0bad1742e106ae71229eeac Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 28 May 2018 20:37:48 +0530 Subject: [PATCH] Add in the redundant ctrl+<234578`> key combinations in normal and application mode. They all conflict with other keys but by implementing them the same as other terminals, I can at least avoid having to explain how they Ctrl+number is broken in traditional terminals over and over again. --- kitty/keys.h | 56 +++++++++++++++++++++++++++++---------------------- kitty/keys.py | 11 ++++++++-- 2 files changed, 41 insertions(+), 26 deletions(-) diff --git a/kitty/keys.h b/kitty/keys.h index 7e786af5e..80acef16c 100644 --- a/kitty/keys.h +++ b/kitty/keys.h @@ -677,19 +677,19 @@ key_lookup(uint8_t key, KeyboardMode mode, uint8_t mods, uint8_t action) { case 7: // 1 return "\x01\x31"; case 8: // 2 - return "\x01\x32"; + return "\x01\x00"; case 9: // 3 - return "\x01\x33"; + return "\x01\x1b"; case 10: // 4 - return "\x01\x34"; + return "\x01\x1c"; case 11: // 5 - return "\x01\x35"; + return "\x01\x1d"; case 12: // 6 return "\x01\x1e"; case 13: // 7 - return "\x01\x37"; + return "\x01\x1f"; case 14: // 8 - return "\x01\x38"; + return "\x01\x7f"; case 15: // 9 return "\x01\x39"; case 16: // SEMICOLON @@ -754,6 +754,8 @@ key_lookup(uint8_t key, KeyboardMode mode, uint8_t mods, uint8_t action) { return "\x01\x1c"; case 46: // RIGHT_BRACKET return "\x01\x1d"; + case 47: // GRAVE_ACCENT + return "\x01\x00"; case 50: // ESCAPE return "\x01\x1b"; case 51: // ENTER @@ -2302,19 +2304,19 @@ key_lookup(uint8_t key, KeyboardMode mode, uint8_t mods, uint8_t action) { case 7: // 1 return "\x01\x31"; case 8: // 2 - return "\x01\x32"; + return "\x01\x00"; case 9: // 3 - return "\x01\x33"; + return "\x01\x1b"; case 10: // 4 - return "\x01\x34"; + return "\x01\x1c"; case 11: // 5 - return "\x01\x35"; + return "\x01\x1d"; case 12: // 6 return "\x01\x1e"; case 13: // 7 - return "\x01\x37"; + return "\x01\x1f"; case 14: // 8 - return "\x01\x38"; + return "\x01\x7f"; case 15: // 9 return "\x01\x39"; case 16: // SEMICOLON @@ -2379,6 +2381,8 @@ key_lookup(uint8_t key, KeyboardMode mode, uint8_t mods, uint8_t action) { return "\x01\x1c"; case 46: // RIGHT_BRACKET return "\x01\x1d"; + case 47: // GRAVE_ACCENT + return "\x01\x00"; case 50: // ESCAPE return "\x01\x1b"; case 51: // ENTER @@ -3936,19 +3940,19 @@ key_lookup(uint8_t key, KeyboardMode mode, uint8_t mods, uint8_t action) { case 7: // 1 return "\x01\x31"; case 8: // 2 - return "\x01\x32"; + return "\x01\x00"; case 9: // 3 - return "\x01\x33"; + return "\x01\x1b"; case 10: // 4 - return "\x01\x34"; + return "\x01\x1c"; case 11: // 5 - return "\x01\x35"; + return "\x01\x1d"; case 12: // 6 return "\x01\x1e"; case 13: // 7 - return "\x01\x37"; + return "\x01\x1f"; case 14: // 8 - return "\x01\x38"; + return "\x01\x7f"; case 15: // 9 return "\x01\x39"; case 16: // SEMICOLON @@ -4013,6 +4017,8 @@ key_lookup(uint8_t key, KeyboardMode mode, uint8_t mods, uint8_t action) { return "\x01\x1c"; case 46: // RIGHT_BRACKET return "\x01\x1d"; + case 47: // GRAVE_ACCENT + return "\x01\x00"; case 50: // ESCAPE return "\x01\x1b"; case 51: // ENTER @@ -5561,19 +5567,19 @@ key_lookup(uint8_t key, KeyboardMode mode, uint8_t mods, uint8_t action) { case 7: // 1 return "\x01\x31"; case 8: // 2 - return "\x01\x32"; + return "\x01\x00"; case 9: // 3 - return "\x01\x33"; + return "\x01\x1b"; case 10: // 4 - return "\x01\x34"; + return "\x01\x1c"; case 11: // 5 - return "\x01\x35"; + return "\x01\x1d"; case 12: // 6 return "\x01\x1e"; case 13: // 7 - return "\x01\x37"; + return "\x01\x1f"; case 14: // 8 - return "\x01\x38"; + return "\x01\x7f"; case 15: // 9 return "\x01\x39"; case 16: // SEMICOLON @@ -5638,6 +5644,8 @@ key_lookup(uint8_t key, KeyboardMode mode, uint8_t mods, uint8_t action) { return "\x01\x1c"; case 46: // RIGHT_BRACKET return "\x01\x1d"; + case 47: // GRAVE_ACCENT + return "\x01\x00"; case 50: // ESCAPE return "\x01\x1b"; case 51: // ENTER diff --git a/kitty/keys.py b/kitty/keys.py index 47c67a652..c60263486 100644 --- a/kitty/keys.py +++ b/kitty/keys.py @@ -107,9 +107,16 @@ control_codes.update({ for i, k in enumerate(range(defines.GLFW_KEY_A, defines.GLFW_KEY_RIGHT_BRACKET + 1)) }) -control_codes[defines.GLFW_KEY_6] = (30,) -control_codes[defines.GLFW_KEY_SLASH] = (31,) +control_codes[defines.GLFW_KEY_GRAVE_ACCENT] = (0,) control_codes[defines.GLFW_KEY_SPACE] = (0,) +control_codes[defines.GLFW_KEY_2] = (0,) +control_codes[defines.GLFW_KEY_3] = (27,) +control_codes[defines.GLFW_KEY_4] = (28,) +control_codes[defines.GLFW_KEY_5] = (29,) +control_codes[defines.GLFW_KEY_6] = (30,) +control_codes[defines.GLFW_KEY_7] = (31,) +control_codes[defines.GLFW_KEY_SLASH] = (31,) +control_codes[defines.GLFW_KEY_8] = (127,) rmkx_key_map = smkx_key_map.copy() rmkx_key_map.update({