Fix some minor issues with spell checking
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
@@ -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))
|
||||||
|
|||||||
Reference in New Issue
Block a user