mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-06-14 00:44:34 +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 + " "
|
textedText = text + " "
|
||||||
|
|
||||||
# Based on http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check/
|
# 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:
|
if hasattr(self.editor, "spellcheck") and self.editor.spellcheck:
|
||||||
for word_object in re.finditer(WORDS, textedText):
|
for word_object in re.finditer(WORDS, textedText):
|
||||||
if self.editor._dict and not self.editor._dict.check(word_object.group(1)):
|
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)
|
format.setUnderlineColor(self._misspelledColor)
|
||||||
# SpellCheckUnderline fails with some fonts
|
# SpellCheckUnderline fails with some fonts
|
||||||
format.setUnderlineStyle(QTextCharFormat.WaveUnderline)
|
format.setUnderlineStyle(QTextCharFormat.WaveUnderline)
|
||||||
self.setFormat(word_object.start(),
|
self.setFormat(word_object.start(1),
|
||||||
word_object.end() - word_object.start(), format)
|
word_object.end(1) - word_object.start(1), format)
|
||||||
|
|
Loading…
Reference in a new issue