From e8383d1850bfb2bf38e924abdea70bbe7eb62237 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 4 Oct 2020 20:32:55 +0200 Subject: [PATCH] Fix spell checking for words with a dash --- 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 7b95ffeb..9a8fcd46 100644 --- a/nw/gui/dochighlight.py +++ b/nw/gui/dochighlight.py @@ -198,7 +198,7 @@ class GuiDocHighlighter(QSyntaxHighlighter): # Build a QRegExp for spell checker # Include additional characters that the highlighter should # consider to be word separators - wordSep = r"_\+/" + wordSep = r"-_\+/" wordSep += nwUnicode.U_ENDASH wordSep += nwUnicode.U_EMDASH self.spellRx = QRegularExpression(r"\b[^\s"+wordSep+r"]+\b") @@ -314,7 +314,7 @@ class GuiDocHighlighter(QSyntaxHighlighter): while rxSpell.hasNext(): rxMatch = rxSpell.next() if not self.theDict.checkWord(rxMatch.captured(0)): - if rxMatch.captured(0) == rxMatch.captured(0).upper(): + if rxMatch.captured(0).isupper(): continue xPos = rxMatch.capturedStart(0) xLen = rxMatch.capturedLength(0)