diff --git a/kitty/key_encoding.c b/kitty/key_encoding.c index 1683d1104f..3c9c15746d 100644 --- a/kitty/key_encoding.c +++ b/kitty/key_encoding.c @@ -150,7 +150,7 @@ encode_function_key(const KeyEvent *ev, char *output) { #define SIMPLE(val) return snprintf(output, KEY_BUFFER_SIZE, "%s", val); char csi_trailer = 'u'; uint32_t key_number = ev->key; - bool legacy_mode = !ev->report_all_event_types && !ev->disambiguate; + bool legacy_mode = !ev->report_all_event_types && !ev->disambiguate && !ev->report_text; if (ev->cursor_key_mode && legacy_mode && !ev->mods.value) { switch(key_number) { @@ -435,7 +435,7 @@ encode_glfw_key_event(const GLFWkeyevent *e, const bool cursor_key_mode, const u ev.has_text = e->text && !startswith_ascii_control_char(e->text); if (!ev.key && !ev.has_text) return 0; bool send_text_standalone = !ev.report_text; - if (!ev.disambiguate && GLFW_FKEY_KP_0 <= ev.key && ev.key <= GLFW_FKEY_KP_BEGIN) { + if (!ev.disambiguate && !ev.report_text && GLFW_FKEY_KP_0 <= ev.key && ev.key <= GLFW_FKEY_KP_BEGIN) { ev.key = convert_kp_key_to_normal_key(ev.key); } switch (e->action) { diff --git a/kitty_tests/keys.py b/kitty_tests/keys.py index ba078dac09..1754e784d4 100644 --- a/kitty_tests/keys.py +++ b/kitty_tests/keys.py @@ -461,6 +461,7 @@ def mkp(name, *a, **kw): ae(kq(defines.GLFW_FKEY_UP), '\x1b[A') ae(kq(defines.GLFW_FKEY_LEFT_SHIFT), csi(num=defines.GLFW_FKEY_LEFT_SHIFT)) ae(kq(defines.GLFW_FKEY_ENTER), '\x1b[13u') + ae(kq(defines.GLFW_FKEY_ENTER, mods=ctrl), '\x1b[13;5u') ae(kq(defines.GLFW_FKEY_TAB), '\x1b[9u') ae(kq(defines.GLFW_FKEY_BACKSPACE), '\x1b[127u')