mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-02 20:12:24 +12:00
Merge pull request #1226 from drmousse/develop
Crash on spellcheck context menu #1224
This commit is contained in:
commit
892f8f0592
|
@ -363,7 +363,7 @@ class PySpellcheckerDictionary(BasicDictionary):
|
|||
|
||||
def getSuggestions(self, word):
|
||||
candidates = self._dict.candidates(word)
|
||||
if word in candidates:
|
||||
if candidates and word in candidates:
|
||||
candidates.remove(word)
|
||||
return candidates
|
||||
|
||||
|
|
|
@ -620,10 +620,11 @@ class textEditView(QTextEdit):
|
|||
|
||||
selectedWord = cursor.selectedText()
|
||||
|
||||
for word in match.replacements:
|
||||
action = self.SpellAction(word, spell_menu)
|
||||
action.correct.connect(self.correctWord)
|
||||
spell_menu.addAction(action)
|
||||
if match.replacements:
|
||||
for word in match.replacements:
|
||||
action = self.SpellAction(word, spell_menu)
|
||||
action.correct.connect(self.correctWord)
|
||||
spell_menu.addAction(action)
|
||||
|
||||
# Adds: add to dictionary
|
||||
addAction = QAction(self.tr("&Add to dictionary"), popup_menu)
|
||||
|
@ -635,7 +636,7 @@ class textEditView(QTextEdit):
|
|||
|
||||
# Only add the spelling suggests to the menu if there are
|
||||
# suggestions.
|
||||
if len(match.replacements) > 0:
|
||||
if match.replacements and len(match.replacements) > 0:
|
||||
# Adds: suggestions
|
||||
popup_menu.insertMenu(popup_menu.actions()[0], spell_menu)
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue