Make some minor improvements to spell check suggest
This commit is contained in:
@@ -1043,7 +1043,7 @@ class GuiDocEditor(QPlainTextEdit):
|
|||||||
if suggest:
|
if suggest:
|
||||||
ctxMenu.addSeparator()
|
ctxMenu.addSeparator()
|
||||||
ctxMenu.addAction(self.tr("Spelling Suggestion(s)"))
|
ctxMenu.addAction(self.tr("Spelling Suggestion(s)"))
|
||||||
for option in suggest:
|
for option in suggest[:15]:
|
||||||
aFix = ctxMenu.addAction(f"{nwUnicode.U_ENDASH} {option}")
|
aFix = ctxMenu.addAction(f"{nwUnicode.U_ENDASH} {option}")
|
||||||
aFix.triggered.connect(
|
aFix.triggered.connect(
|
||||||
lambda _, option=option: self._correctWord(sCursor, option)
|
lambda _, option=option: self._correctWord(sCursor, option)
|
||||||
@@ -1052,9 +1052,8 @@ class GuiDocEditor(QPlainTextEdit):
|
|||||||
ctxMenu.addAction("%s %s" % (nwUnicode.U_ENDASH, self.tr("No Suggestions")))
|
ctxMenu.addAction("%s %s" % (nwUnicode.U_ENDASH, self.tr("No Suggestions")))
|
||||||
|
|
||||||
ctxMenu.addSeparator()
|
ctxMenu.addSeparator()
|
||||||
aAdd = QAction(self.tr("Add Word to Dictionary"), ctxMenu)
|
aAdd = ctxMenu.addAction(self.tr("Add Word to Dictionary"))
|
||||||
aAdd.triggered.connect(lambda: self._addWord(word, block))
|
aAdd.triggered.connect(lambda: self._addWord(word, block))
|
||||||
ctxMenu.addAction(aAdd)
|
|
||||||
|
|
||||||
# Execute the context menu
|
# Execute the context menu
|
||||||
ctxMenu.exec_(self.viewport().mapToGlobal(pos))
|
ctxMenu.exec_(self.viewport().mapToGlobal(pos))
|
||||||
|
|||||||
@@ -101,9 +101,8 @@ class GuiTextDocument(QTextDocument):
|
|||||||
cursor = QTextCursor(self)
|
cursor = QTextCursor(self)
|
||||||
cursor.setPosition(pos)
|
cursor.setPosition(pos)
|
||||||
block = cursor.block()
|
block = cursor.block()
|
||||||
if block.isValid():
|
|
||||||
data = block.userData()
|
data = block.userData()
|
||||||
if isinstance(data, TextBlockData):
|
if block.isValid() and isinstance(data, TextBlockData):
|
||||||
text = block.text()
|
text = block.text()
|
||||||
check = pos - block.position()
|
check = pos - block.position()
|
||||||
if check >= 0:
|
if check >= 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user