diff --git a/novelwriter/gui/doceditor.py b/novelwriter/gui/doceditor.py index 56b42ec7..a29fe34b 100644 --- a/novelwriter/gui/doceditor.py +++ b/novelwriter/gui/doceditor.py @@ -1095,6 +1095,12 @@ class GuiDocEditor(QPlainTextEdit): self._completer.hide() return + @pyqtSlot() + def _openContextFromCursor(self) -> None: + """Open the spell check context menu at the cursor.""" + self._openContextMenu(self.cursorRect().center()) + return + @pyqtSlot("QPoint") def _openContextMenu(self, pos: QPoint) -> None: """Open the editor context menu at a given coordinate.""" @@ -1938,11 +1944,6 @@ class GuiDocEditor(QPlainTextEdit): self.requestProjectItemRenamed.emit(self._docHandle, text) return - def _openContextFromCursor(self) -> None: - """Open the spell check context menu at the cursor.""" - self._openContextMenu(self.cursorRect().center()) - return - def _docAutoReplace(self, text: str) -> None: """Auto-replace text elements based on main configuration.""" cursor = self.textCursor() diff --git a/novelwriter/gui/dochighlight.py b/novelwriter/gui/dochighlight.py index a19e0945..d0b95451 100644 --- a/novelwriter/gui/dochighlight.py +++ b/novelwriter/gui/dochighlight.py @@ -491,7 +491,7 @@ class TextBlockData(QTextBlockUserData): self._spellErrors = [] checker = SHARED.spelling - for match in RX_WORDS.finditer(text.replace("_", " ")): + for match in RX_WORDS.finditer(text.replace("_", " "), offset): if ( (word := match.group(0)) and not (word.isnumeric() or word.isupper() or checker.checkWord(word))