Skip to content

Commit

Permalink
Corrects: Spell checker is active for partial words. olivierkes#166
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierkes committed Oct 19, 2017
1 parent 4484423 commit 6ec0c19
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions manuskript/ui/editors/basicHighlighter.py
Expand Up @@ -91,13 +91,13 @@ def highlightBlockAfter(self, text):
textedText = text + " "

# Based on http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check/
WORDS = '(?iu)([\w\']+)\W' # (?iu) means case insensitive and unicode
WORDS = '(?iu)([\w\']+)[^\'\w]' # (?iu) means case insensitive and unicode
if hasattr(self.editor, "spellcheck") and self.editor.spellcheck:
for word_object in re.finditer(WORDS, textedText):
if self.editor._dict and not self.editor._dict.check(word_object.group(1)):
format = self.format(word_object.start())
format = self.format(word_object.start(1))
format.setUnderlineColor(self._misspelledColor)
# SpellCheckUnderline fails with some fonts
format.setUnderlineStyle(QTextCharFormat.WaveUnderline)
self.setFormat(word_object.start(),
word_object.end() - word_object.start(), format)
self.setFormat(word_object.start(1),
word_object.end(1) - word_object.start(1), format)

0 comments on commit 6ec0c19

Please sign in to comment.