mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-17 11:22:28 +12:00
Corrects: Spell checker is active for partial words. #166
This commit is contained in:
parent
4484423ace
commit
6ec0c19376
|
@ -91,13 +91,13 @@ class basicHighlighter(QSyntaxHighlighter):
|
|||
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)
|
||||
|
|
Loading…
Reference in a new issue