fix autotype custom attributes

This commit is contained in:
thez3ro 2018-03-04 22:25:28 +01:00 committed by Janek Bevendorff
parent d3a80513a7
commit 5f9f27604b
2 changed files with 29 additions and 19 deletions

View file

@ -659,6 +659,7 @@ bool AutoType::checkSyntax(const QString& string)
QString delay = "DELAY=\\d+";
QString beep = "BEEP\\s\\d+\\s\\d+";
QString vkey = "VKEY(?:-[EN]X)?\\s\\w+";
QString customAttributes = "S:(?:[^\\{\\}])+";
// these chars aren't in parentheses
QString shortcutKeys = "[\\^\\%~\\+@]";
@ -666,7 +667,7 @@ bool AutoType::checkSyntax(const QString& string)
QString fixedStrings = "[^\\^\\%~\\+@\\{\\}]*";
QRegularExpression autoTypeSyntax("^(?:" + shortcutKeys + "|" + fixedStrings + "|\\{(?:" + normalCommands + "|" + specialLiterals +
"|" + functionKeys + "|" + numpad + "|" + delay + "|" + beep + "|" + vkey + ")\\})*$",
"|" + functionKeys + "|" + numpad + "|" + delay + "|" + beep + "|" + vkey + ")\\}|\\{" + customAttributes + "\\})*$",
QRegularExpression::CaseInsensitiveOption);
QRegularExpressionMatch match = autoTypeSyntax.match(string);
return match.hasMatch();