From 853ca5827e67bb4071203bee0a3c33daee46f436 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 12 Jan 2023 22:49:23 +0100 Subject: [PATCH] Simplify a regex and fix a typo - The usage of `|` is wrong - It's `mWhiteListQuotes` and not `mWhiteListQoutes` - Replace weird usage of `{}`-based quantifiers --- apps/opencs/view/world/scriptedit.cpp | 4 ++-- apps/opencs/view/world/scriptedit.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/opencs/view/world/scriptedit.cpp b/apps/opencs/view/world/scriptedit.cpp index 68c477ffd8..c8505f007f 100644 --- a/apps/opencs/view/world/scriptedit.cpp +++ b/apps/opencs/view/world/scriptedit.cpp @@ -55,7 +55,7 @@ CSVWorld::ScriptEdit::ScriptEdit(const CSMDoc::Document& document, ScriptHighlig , mTabCharCount(4) , mMarkOccurrences(true) , mDocument(document) - , mWhiteListQoutes("^[a-z|_]{1}[a-z|0-9|_]{0,}$", QRegularExpression::CaseInsensitiveOption) + , mWhiteListQuotes("^[a-zA-Z_][a-zA-Z0-9_]*$") { wrapLines(false); setTabWidth(); @@ -188,7 +188,7 @@ bool CSVWorld::ScriptEdit::stringNeedsQuote(const std::string& id) const { const QString string(QString::fromUtf8(id.c_str())); // I'm not quite sure when do we need to put quotes. To be safe we will use quotes for anything other than… - return !(string.contains(mWhiteListQoutes)); + return !(string.contains(mWhiteListQuotes)); } void CSVWorld::ScriptEdit::setTabWidth() diff --git a/apps/opencs/view/world/scriptedit.hpp b/apps/opencs/view/world/scriptedit.hpp index befa60cad2..53fa88ced3 100644 --- a/apps/opencs/view/world/scriptedit.hpp +++ b/apps/opencs/view/world/scriptedit.hpp @@ -95,7 +95,7 @@ namespace CSVWorld private: QVector mAllowedTypes; const CSMDoc::Document& mDocument; - const QRegularExpression mWhiteListQoutes; + const QRegularExpression mWhiteListQuotes; void dragEnterEvent(QDragEnterEvent* event) override;