Fix some minor issues with spell checking

This commit is contained in:
Veronica Berglyd Olsen
2024-09-28 11:41:26 +02:00
parent b2e760a284
commit a716f31b17
2 changed files with 7 additions and 6 deletions
+6 -5
View File
@@ -1095,6 +1095,12 @@ class GuiDocEditor(QPlainTextEdit):
self._completer.hide() self._completer.hide()
return return
@pyqtSlot()
def _openContextFromCursor(self) -> None:
"""Open the spell check context menu at the cursor."""
self._openContextMenu(self.cursorRect().center())
return
@pyqtSlot("QPoint") @pyqtSlot("QPoint")
def _openContextMenu(self, pos: QPoint) -> None: def _openContextMenu(self, pos: QPoint) -> None:
"""Open the editor context menu at a given coordinate.""" """Open the editor context menu at a given coordinate."""
@@ -1938,11 +1944,6 @@ class GuiDocEditor(QPlainTextEdit):
self.requestProjectItemRenamed.emit(self._docHandle, text) self.requestProjectItemRenamed.emit(self._docHandle, text)
return 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: def _docAutoReplace(self, text: str) -> None:
"""Auto-replace text elements based on main configuration.""" """Auto-replace text elements based on main configuration."""
cursor = self.textCursor() cursor = self.textCursor()
+1 -1
View File
@@ -491,7 +491,7 @@ class TextBlockData(QTextBlockUserData):
self._spellErrors = [] self._spellErrors = []
checker = SHARED.spelling checker = SHARED.spelling
for match in RX_WORDS.finditer(text.replace("_", " ")): for match in RX_WORDS.finditer(text.replace("_", " "), offset):
if ( if (
(word := match.group(0)) (word := match.group(0))
and not (word.isnumeric() or word.isupper() or checker.checkWord(word)) and not (word.isnumeric() or word.isupper() or checker.checkWord(word))