From 73f1547e9f38d20f1ddec0fc4fc0138466ba399e Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Sat, 11 May 2019 00:26:19 +0200 Subject: [PATCH] Using a better word splitting regex, but need to replace underscores with spaces. --- nw/gui/dochighlight.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nw/gui/dochighlight.py b/nw/gui/dochighlight.py index 5efad405..59923808 100644 --- a/nw/gui/dochighlight.py +++ b/nw/gui/dochighlight.py @@ -145,7 +145,7 @@ class GuiDocHighlighter(QSyntaxHighlighter): # Build a QRegExp for each pattern and for the spell checker self.rules = [(QRegularExpression(a),b) for (a,b) in self.hRules] - self.spellRx = QRegularExpression(r"[\w\'{:s}&&[^_]]+".format(self.mainConf.fmtApostrophe)) + self.spellRx = QRegularExpression(r"\b[^\s]+\b") logger.debug("DocHighlighter initialisation complete") @@ -192,7 +192,7 @@ class GuiDocHighlighter(QSyntaxHighlighter): if self.theDict is None: return - rxSpell = self.spellRx.globalMatch(theText, 0) + rxSpell = self.spellRx.globalMatch(theText.replace("_"," "), 0) while rxSpell.hasNext(): rxMatch = rxSpell.next() if not self.theDict.check(rxMatch.captured(0)):