From f9e38d33116827cb2edfef4965e03f73365082cb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 5 Apr 2024 13:53:17 +0530 Subject: [PATCH] Nicer debug output for IME text commit event --- kitty/keys.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/kitty/keys.c b/kitty/keys.c index 2ea6491e4..f2f793d72 100644 --- a/kitty/keys.c +++ b/kitty/keys.c @@ -152,10 +152,16 @@ on_key_input(GLFWkeyevent *ev) { const uint32_t key = ev->key, native_key = ev->native_key; const char *text = ev->text ? ev->text : ""; - debug("\x1b[33mon_key_input\x1b[m: glfw key: 0x%x native_code: 0x%x action: %s %stext: '%s' state: %d ", - key, native_key, - (action == GLFW_RELEASE ? "RELEASE" : (action == GLFW_PRESS ? "PRESS" : "REPEAT")), - format_mods(mods), text, ev->ime_state); + if (OPT(debug_keyboard)) { + if (!key && !native_key && text[0]) { + debug("\x1b[33mon_IME_input\x1b[m: text: %s ", text); + } else { + debug("\x1b[33mon_key_input\x1b[m: glfw key: 0x%x native_code: 0x%x action: %s %stext: '%s' state: %d ", + key, native_key, + (action == GLFW_RELEASE ? "RELEASE" : (action == GLFW_PRESS ? "PRESS" : "REPEAT")), + format_mods(mods), text, ev->ime_state); + } + } if (!w) { debug("no active window, ignoring\n"); return; } if (OPT(mouse_hide_wait) < 0 && !is_modifier_key(key)) hide_mouse(global_state.callback_os_window); Screen *screen = w->render_data.screen;