From 097be1a5cd263a260e112bfa5a228cdeff31a036 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Thu, 31 Mar 2022 18:18:33 -0400 Subject: [PATCH] Fix Auto-Typing single character placeholders * Fix #7743 - Include # in placeholder list * This change fixes typing single character placeholders (escaped placeholders) on Windows. Previously we were sending these as raw key presses which didn't properly press Shift or other modifiers. Now they are sent as unicode characters unless in virtual mode (the expected behavior). --- src/autotype/AutoType.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/autotype/AutoType.cpp b/src/autotype/AutoType.cpp index 7764284c2..102cd95ab 100644 --- a/src/autotype/AutoType.cpp +++ b/src/autotype/AutoType.cpp @@ -72,19 +72,20 @@ namespace {"multiply", Qt::Key_Asterisk}, {"divide", Qt::Key_Slash}, {"leftbrace", Qt::Key_BraceLeft}, - {"{", Qt::Key_BraceLeft}, + {"{", Qt::Key_unknown}, {"rightbrace", Qt::Key_BraceRight}, - {"}", Qt::Key_BraceRight}, + {"}", Qt::Key_unknown}, {"leftparen", Qt::Key_ParenLeft}, - {"(", Qt::Key_ParenLeft}, + {"(", Qt::Key_unknown}, {"rightparen", Qt::Key_ParenRight}, - {")", Qt::Key_ParenRight}, - {"[", Qt::Key_BracketLeft}, - {"]", Qt::Key_BracketRight}, - {"+", Qt::Key_Plus}, - {"%", Qt::Key_Percent}, - {"^", Qt::Key_AsciiCircum}, - {"~", Qt::Key_AsciiTilde}, + {")", Qt::Key_unknown}, + {"[", Qt::Key_unknown}, + {"]", Qt::Key_unknown}, + {"+", Qt::Key_unknown}, + {"%", Qt::Key_unknown}, + {"^", Qt::Key_unknown}, + {"~", Qt::Key_unknown}, + {"#", Qt::Key_unknown}, {"numpad0", Qt::Key_0}, {"numpad1", Qt::Key_1}, {"numpad2", Qt::Key_2}, @@ -612,7 +613,12 @@ AutoType::parseSequence(const QString& entrySequence, const Entry* entry, QStrin error = tr("Too many repetitions detected, max is %1: %2").arg(maxRepetition).arg(fullPlaceholder); return {}; } - auto action = QSharedPointer::create(g_placeholderToKey[placeholder], modifiers); + QSharedPointer action; + if (g_placeholderToKey[placeholder] == Qt::Key_unknown) { + action = QSharedPointer::create(placeholder[0], modifiers); + } else { + action = QSharedPointer::create(g_placeholderToKey[placeholder], modifiers); + } for (int i = 1; i <= repeat && i <= maxRepetition; ++i) { actions << action; }