Fix spell checking when 4 byte are in use

This commit is contained in:
Veronica Berglyd Olsen
2025-07-05 17:19:02 +02:00
parent 3c8a0ace60
commit ad3760762f
4 changed files with 54 additions and 56 deletions
+4 -4
View File
@@ -1202,13 +1202,13 @@ class GuiDocEditor(QPlainTextEdit):
# Spell Checking
if SHARED.project.data.spellCheck:
word, cPos, cLen, suggest = self._qDocument.spellErrorAtPos(pCursor.position())
if word and cPos >= 0 and cLen > 0:
word, offset, suggest = self._qDocument.spellErrorAtPos(pCursor.position())
if word and offset >= 0:
logger.debug("Word '%s' is misspelled", word)
block = pCursor.block()
sCursor = self.textCursor()
sCursor.setPosition(block.position() + cPos)
sCursor.movePosition(QtMoveRight, QtKeepAnchor, cLen)
sCursor.setPosition(block.position() + offset)
sCursor.movePosition(QtMoveRight, QtKeepAnchor, len(word))
if suggest:
ctxMenu.addSeparator()
qtAddAction(ctxMenu, self.tr("Spelling Suggestion(s)"))