From ff6b4bcfa7d242f1bbc4678166f34b1ed6326703 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sat, 13 Jun 2020 20:44:27 +0200 Subject: [PATCH] Improve the word saparation detection of the spell check highlighting --- nw/gui/dochighlight.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nw/gui/dochighlight.py b/nw/gui/dochighlight.py index 4754110d..abf3c122 100644 --- a/nw/gui/dochighlight.py +++ b/nw/gui/dochighlight.py @@ -203,9 +203,10 @@ class GuiDocHighlighter(QSyntaxHighlighter): # Build a QRegExp for spell checker # Include additional characters that the highlighter should # consider to be word separators - wordSep = "_+" + wordSep = "_\+" + wordSep += nwUnicode.U_ENDASH wordSep += nwUnicode.U_EMDASH - self.spellRx = QRegularExpression("\\b[^\\s%s]+\\b" % wordSep) + self.spellRx = QRegularExpression(r"\b[^\s"+wordSep+r"]+\b") self.spellRx.setPatternOptions(QRegularExpression.UseUnicodePropertiesOption) return True