From 7fbde0c649224465a4eb242ef3575ebec17d84ed Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Tue, 9 Jul 2019 10:53:37 +0200 Subject: [PATCH] Key control: escape one-char keys with apostrophes --- src/keyboard_control.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/keyboard_control.cpp b/src/keyboard_control.cpp index e0a323154..3f144a14b 100644 --- a/src/keyboard_control.cpp +++ b/src/keyboard_control.cpp @@ -319,15 +319,12 @@ static string get_keycode_representation(int64_t ch) { case K_LEFT: return "KEY_LEFT"; case K_RIGHT: return "KEY_RIGHT"; } - if (ch == ' ') { - return "' '"; - } - if (ch < UCHAR_MAX && isprint(ch)) { - return string(1, ch); + if (ch <= UCHAR_MAX && isprint(ch)) { + return string("'") + string(1, ch) + "'"; } if (is_utf8(ch)) { - return get_utf8_representation(ch); + return string("'") + get_utf8_representation(ch) + "'"; } stringstream oss;