From 6d046f251ef214c11b8794604d7eebd82ccfa4b7 Mon Sep 17 00:00:00 2001 From: thez3ro Date: Sat, 30 Dec 2017 14:16:18 +0100 Subject: [PATCH] Remove minus since it's an invalid literal --- src/autotype/AutoType.cpp | 2 +- src/gui/entry/EditEntryWidget.cpp | 1 - tests/TestAutoType.cpp | 6 +++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/autotype/AutoType.cpp b/src/autotype/AutoType.cpp index a3d8b0533..2df3b4f1e 100644 --- a/src/autotype/AutoType.cpp +++ b/src/autotype/AutoType.cpp @@ -616,7 +616,7 @@ bool AutoType::checkSyntax(const QString& string) // the ":" allows custom commands with syntax S:Field // exclude BEEP otherwise will be checked as valid QString normalCommands = "(?!BEEP\\s)[A-Z:]*" + allowRepetition; - QString specialLiterals = "[\\^\\%\\(\\)~\\{\\}\\[\\]\\+-]" + allowRepetition; + QString specialLiterals = "[\\^\\%\\(\\)~\\{\\}\\[\\]\\+]" + allowRepetition; QString functionKeys = "(?:F[1-9]" + allowRepetition + "|F1[0-2])" + allowRepetition; QString numpad = "NUMPAD\\d" + allowRepetition; QString delay = "DELAY=\\d+"; diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp index 2c65d3ec8..707d2f6d2 100644 --- a/src/gui/entry/EditEntryWidget.cpp +++ b/src/gui/entry/EditEntryWidget.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include "autotype/AutoType.h" #include "core/Config.h" diff --git a/tests/TestAutoType.cpp b/tests/TestAutoType.cpp index da245d8cb..2f980e546 100644 --- a/tests/TestAutoType.cpp +++ b/tests/TestAutoType.cpp @@ -286,7 +286,7 @@ void TestAutoType::testGlobalAutoTypeRegExp() void TestAutoType::testAutoTypeSyntaxChecks() { // Huge sequence - QCOMPARE(true, AutoType::checkSyntax("{word 23}{F1 23}{~ 23}{% 23}{^}{F12}{(}{) 23}{[}{[}{]}{Delay=23}{+}{-}~+%@fixedstring")); + QCOMPARE(true, AutoType::checkSyntax("{word 23}{F1 23}{~ 23}{% 23}{^}{F12}{(}{) 23}{[}{[}{]}{Delay=23}{+}{SUBTRACT}~+%@fixedstring")); QCOMPARE(true, AutoType::checkSyntax("{NUMPAD1 3}")); @@ -298,6 +298,10 @@ void TestAutoType::testAutoTypeSyntaxChecks() QCOMPARE(true, AutoType::checkSyntax("{VKEY-EX 0x01}")); // Bad sequence QCOMPARE(false, AutoType::checkSyntax("{{{}}{}{}}{{}}")); + // Good sequence + QCOMPARE(true, AutoType::checkSyntax("{{}{}}{}}{{}")); + QCOMPARE(true, AutoType::checkSyntax("{]}{[}{[}{]}")); + QCOMPARE(true, AutoType::checkSyntax("{)}{(}{(}{)}")); // High DelAY / low delay QCOMPARE(true, AutoType::checkHighDelay("{DelAY 50000}")); QCOMPARE(false, AutoType::checkHighDelay("{delay 50}"));