1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-30 16:20:21 +00:00

Merge branch 'simplify_re' into 'master'

Simplify a regex and fix a typo

See merge request OpenMW/openmw!2608
This commit is contained in:
psi29a 2023-01-13 09:55:45 +00:00
commit f8534bd00e
2 changed files with 3 additions and 3 deletions

View File

@ -55,7 +55,7 @@ CSVWorld::ScriptEdit::ScriptEdit(const CSMDoc::Document& document, ScriptHighlig
, mTabCharCount(4) , mTabCharCount(4)
, mMarkOccurrences(true) , mMarkOccurrences(true)
, mDocument(document) , mDocument(document)
, mWhiteListQoutes("^[a-z|_]{1}[a-z|0-9|_]{0,}$", QRegularExpression::CaseInsensitiveOption) , mWhiteListQuotes("^[a-zA-Z_][a-zA-Z0-9_]*$")
{ {
wrapLines(false); wrapLines(false);
setTabWidth(); setTabWidth();
@ -188,7 +188,7 @@ bool CSVWorld::ScriptEdit::stringNeedsQuote(const std::string& id) const
{ {
const QString string(QString::fromUtf8(id.c_str())); 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… // 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() void CSVWorld::ScriptEdit::setTabWidth()

View File

@ -95,7 +95,7 @@ namespace CSVWorld
private: private:
QVector<CSMWorld::UniversalId::Type> mAllowedTypes; QVector<CSMWorld::UniversalId::Type> mAllowedTypes;
const CSMDoc::Document& mDocument; const CSMDoc::Document& mDocument;
const QRegularExpression mWhiteListQoutes; const QRegularExpression mWhiteListQuotes;
void dragEnterEvent(QDragEnterEvent* event) override; void dragEnterEvent(QDragEnterEvent* event) override;