From 7cfd80621e218b18b2ef9d04b47bcecfc603759d Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Sun, 9 Nov 2014 12:16:19 +0100 Subject: [PATCH] Don't syntax highlight table names in the middle of other identifiers Assuming you have a table names 't', the syntax highlighter would have highlighted all ts in column names and other identifiers which aren't highlighted otherwise. This is fixed by this commit. --- src/SQLiteSyntaxHighlighter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SQLiteSyntaxHighlighter.cpp b/src/SQLiteSyntaxHighlighter.cpp index de4b3fea..f2afc960 100644 --- a/src/SQLiteSyntaxHighlighter.cpp +++ b/src/SQLiteSyntaxHighlighter.cpp @@ -101,7 +101,7 @@ void SQLiteSyntaxHighlighter::setTableNames(const QStringList &tablenames) tableNameRules.clear(); foreach(const QString& tblname, tablenames) { HighlightingRule rule; - rule.pattern = QRegExp(tblname); + rule.pattern = QRegExp(QString("\\b%1\\b").arg(tblname)); rule.format = tableFormat; tableNameRules.append(rule); }