mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-06-16 01:44:34 +12:00
Make word match for spell check exclude underscore from words
See issue #283. Adds (?!_) to perform negative lookahead to exclude "_" from pattern match. https://stackoverflow.com/questions/14858346/regular-expressions-how-to-express-w-without-underscore
This commit is contained in:
parent
4638ba878f
commit
63b471e10d
|
@ -146,8 +146,9 @@ class BasicHighlighter(QSyntaxHighlighter):
|
|||
textedText = text + " "
|
||||
|
||||
# Based on http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check/
|
||||
WORDS = r'(?iu)([\w\']+)[^\'\w]'
|
||||
# (?iu) means case insensitive and unicode
|
||||
WORDS = r'(?iu)(((?!_)[\w\'])+)'
|
||||
# (?iu) means case insensitive and Unicode
|
||||
# (?!_) means perform negative lookahead to exclude "_" from pattern match. See issue #283
|
||||
if hasattr(self.editor, "spellcheck") and self.editor.spellcheck:
|
||||
for word_object in re.finditer(WORDS, textedText):
|
||||
if (self.editor._dict
|
||||
|
|
Loading…
Reference in a new issue