Fixed context menu not appearing when no words were mispelled.

This commit is contained in:
Ricky 2016-08-07 04:31:43 -07:00
parent 0ea1c66f4e
commit c1e3bb9c82

View File

@ -156,13 +156,13 @@ class InputLineSpell(QtGui.QTextEdit):
# Check if the selected word is misspelled and offer spelling # Check if the selected word is misspelled and offer spelling
# suggestions if it is. # suggestions if it is.
if enchant and self.spelldict: if enchant and self.spelldict:
top_action = popup_menu.actions()[0]
if self.textCursor().hasSelection(): if self.textCursor().hasSelection():
text = unicode(self.textCursor().selectedText()) text = unicode(self.textCursor().selectedText())
if not self.spelldict.check(text): if not self.spelldict.check(text):
suggestions = self.spelldict.suggest(text) suggestions = self.spelldict.suggest(text)
if len(suggestions) != 0: if len(suggestions) != 0:
popup_menu.insertSeparator(popup_menu.actions()[0]) popup_menu.insertSeparator(popup_menu.actions()[0])
top_action = popup_menu.actions()[0]
for suggest in suggestions: for suggest in suggestions:
self._menu_action(suggest, popup_menu, self._menu_action(suggest, popup_menu,
self.correctWord, after=top_action) self.correctWord, after=top_action)