From 47199ba564628f8e7230ce3cea80f65aefe17dfa Mon Sep 17 00:00:00 2001 From: Mariusz Glebocki Date: Thu, 24 May 2018 08:47:40 -0400 Subject: [PATCH] Allow any character(s) as a key in key binding. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: The key (the part before modifiers) is interpreted by QKeySequence. For special keys (everything except printable characters), it uses names from `Qt::Key` without `Key_` prefix. For character keys, it uses the character itself, and it is not possible to use e.g. `Comma`. For this reason limited set of characters limits possible key bindings. BUG: 385380 FIXED-IN: 18.08 Test Plan: * In profile's key bindings settings (or your keysym file) create entry: ``` key ,-Shift+Ctrl-Alt+Ansi : "Hello from keysym" ``` * Change `-Alt` to `+Alt` if you have a conflict. Do not change shift (the shortcut would trigger on `<` instead of `,`). You can also use e.g. ``;'[]=` instead of `,`. AltGr+letter works too, so `ą`, `á`, etc. can be used. * Save and close settings * Press `Ctrl+,` Expected result: "Hello from keysym" is typed Actual result: * the key binding does not work * empty rows appear in key bindings table Reviewers: #konsole, hindenburg Reviewed By: #konsole, hindenburg Subscribers: hindenburg, konsole-devel, #konsole Tags: #konsole Differential Revision: https://phabricator.kde.org/D13081 --- src/KeyboardTranslator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KeyboardTranslator.cpp b/src/KeyboardTranslator.cpp index b3a68e7f..6f350391 100644 --- a/src/KeyboardTranslator.cpp +++ b/src/KeyboardTranslator.cpp @@ -391,7 +391,7 @@ QList KeyboardTranslatorReader::tokenize(const QRegularExpression::OptimizeOnFirstUsageOption); // key line: key KeySequence : "output" // key line: key KeySequence : command - static const QRegularExpression key(QStringLiteral("key\\s+([\\w\\+\\s\\-\\*\\.]+)\\s*:\\s*(\"(.*)\"|\\w+)"), + static const QRegularExpression key(QStringLiteral("key\\s+(.+?)\\s*:\\s*(\"(.*)\"|\\w+)"), QRegularExpression::OptimizeOnFirstUsageOption); QList list;