Skip to content

Commit d93e8eb

Browse files
Merge branch 'develop' of github.com:olivierkes/manuskript into develop
2 parents 79ba7b5 + 892f8f0 commit d93e8eb

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

manuskript/functions/spellchecker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def isMisspelled(self, word):
363363

364364
def getSuggestions(self, word):
365365
candidates = self._dict.candidates(word)
366-
if word in candidates:
366+
if candidates and word in candidates:
367367
candidates.remove(word)
368368
return candidates
369369

manuskript/ui/views/textEditView.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -620,10 +620,11 @@ def createStandardContextMenu(self):
620620

621621
selectedWord = cursor.selectedText()
622622

623-
for word in match.replacements:
624-
action = self.SpellAction(word, spell_menu)
625-
action.correct.connect(self.correctWord)
626-
spell_menu.addAction(action)
623+
if match.replacements:
624+
for word in match.replacements:
625+
action = self.SpellAction(word, spell_menu)
626+
action.correct.connect(self.correctWord)
627+
spell_menu.addAction(action)
627628

628629
# Adds: add to dictionary
629630
addAction = QAction(self.tr("&Add to dictionary"), popup_menu)
@@ -635,7 +636,7 @@ def createStandardContextMenu(self):
635636

636637
# Only add the spelling suggests to the menu if there are
637638
# suggestions.
638-
if len(match.replacements) > 0:
639+
if match.replacements and len(match.replacements) > 0:
639640
# Adds: suggestions
640641
popup_menu.insertMenu(popup_menu.actions()[0], spell_menu)
641642
else:

0 commit comments

Comments
 (0)