From aaa904ce3208a6b576f036d99338f9f7dbe054c4 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Wed, 22 Mar 2023 00:07:51 +0100 Subject: only insert key if printable --- dmenu-wl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'dmenu-wl.c') diff --git a/dmenu-wl.c b/dmenu-wl.c index a3d30ae..436d0bb 100644 --- a/dmenu-wl.c +++ b/dmenu-wl.c @@ -413,8 +413,6 @@ handle_keyboard_event() char buf[8]; int genmatch = 0; - xkb_keysym_to_utf8(client.keys.sym, buf, sizeof(buf)); - if (client.keys.state == WL_KEYBOARD_KEY_STATE_PRESSED) { switch (client.keys.sym) { case XKB_KEY_KP_Enter: /* fallthrough */ @@ -431,7 +429,9 @@ handle_keyboard_event() genmatch = 1; break; default: - strncpy(input_field + strlen(input_field), buf, MAX_LINE_LENGTH - strlen(input_field)); + if (xkb_keysym_to_utf8(client.keys.sym, buf, sizeof(buf))) { + strncpy(input_field + strlen(input_field), buf, MAX_LINE_LENGTH - strlen(input_field)); + } genmatch = 1; break; } -- cgit v1.2.3-70-g09d2