Make some minor improvements to spell check suggest

This commit is contained in:
Veronica Berglyd Olsen
2023-09-10 21:52:38 +02:00
parent f1e28e21f8
commit dea5c54ef0
2 changed files with 12 additions and 14 deletions
+10 -11
View File
@@ -101,17 +101,16 @@ class GuiTextDocument(QTextDocument):
cursor = QTextCursor(self)
cursor.setPosition(pos)
block = cursor.block()
if block.isValid():
data = block.userData()
if isinstance(data, TextBlockData):
text = block.text()
check = pos - block.position()
if check >= 0:
for cPos, cLen in data.spellErrors:
cEnd = cPos + cLen
if cPos <= check <= cEnd:
word = text[cPos:cEnd]
return word, cPos, cLen, SHARED.spelling.suggestWords(word)
data = block.userData()
if block.isValid() and isinstance(data, TextBlockData):
text = block.text()
check = pos - block.position()
if check >= 0:
for cPos, cLen in data.spellErrors:
cEnd = cPos + cLen
if cPos <= check <= cEnd:
word = text[cPos:cEnd]
return word, cPos, cLen, SHARED.spelling.suggestWords(word)
return "", -1, -1, []
# END Class GuiTextDocument