From 50d2ef3b90d22c40306b40dccd7f9211d60b491c Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 1 Mar 2018 08:01:39 +0100 Subject: [PATCH] Fix handling of printable control keys in KeyInfo.text() --- qutebrowser/keyinput/keyutils.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/qutebrowser/keyinput/keyutils.py b/qutebrowser/keyinput/keyutils.py index 1feb371a8..5c1097aa8 100644 --- a/qutebrowser/keyinput/keyutils.py +++ b/qutebrowser/keyinput/keyutils.py @@ -254,8 +254,17 @@ class KeyInfo: def text(self): """Get the text which would be displayed when pressing this key.""" - if self.key == Qt.Key_Space: - return ' ' + control = { + Qt.Key_Space: ' ', + Qt.Key_Tab: '\t', + Qt.Key_Backspace: '\b', + Qt.Key_Return: '\r', + Qt.Key_Enter: '\r', + Qt.Key_Escape: '\x1b', + } + + if self.key in control: + return control[self.key] elif not is_printable(self.key): return ''