From cdcf8ed3bd1628bf00f0b95cd14bf4770b5030da Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 13 Apr 2021 07:41:47 +0530 Subject: [PATCH] Add some colors to keyboad debug output --- glfw/xkb_glfw.c | 2 +- kitty/keys.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/glfw/xkb_glfw.c b/glfw/xkb_glfw.c index ba92bbeb8..dbd5b6a0f 100644 --- a/glfw/xkb_glfw.c +++ b/glfw/xkb_glfw.c @@ -711,7 +711,7 @@ glfw_xkb_handle_key_event(_GLFWwindow *window, _GLFWXKBData *xkb, xkb_keycode_t #else ibus_keycode -= 8; #endif - debug("%s xkb_keycode: 0x%x ", action == GLFW_RELEASE ? "Release" : "Press", xkb_keycode); + debug("%s xkb_keycode: 0x%x ", action == GLFW_RELEASE ? "\x1b[32mRelease\x1b[m" : "\x1b[31mPress\x1b[m", xkb_keycode); XKBStateGroup *sg = &xkb->states; int num_syms = xkb_state_key_get_syms(sg->state, code_for_sym, &syms); int num_clean_syms = xkb_state_key_get_syms(sg->clean_state, code_for_sym, &clean_syms); diff --git a/kitty/keys.c b/kitty/keys.c index cde7bf4e3..38c4d673b 100644 --- a/kitty/keys.c +++ b/kitty/keys.c @@ -97,7 +97,7 @@ on_key_input(GLFWkeyevent *ev) { const uint32_t key = ev->key, native_key = ev->native_key; const char *text = ev->text ? ev->text : ""; - debug("on_key_input: glfw key: %d native_code: 0x%x action: %s mods: 0x%x text: '%s' state: %d ", + debug("\x1b[33mon_key_input\x1b[m: glfw key: %d native_code: 0x%x action: %s mods: 0x%x text: '%s' state: %d ", key, native_key, (action == GLFW_RELEASE ? "RELEASE" : (action == GLFW_PRESS ? "PRESS" : "REPEAT")), mods, text, ev->ime_state);