Edit Book: Spell Check: If there are no suggestions fill the suggested word box witht he original word. Fixes #1664284 [[enhancement] show original word in "change selected word to" when there are no spelling suggestions in the "check spelling" window](https://bugs.launchpad.net/calibre/+bug/1664284)

This commit is contained in:
Kovid Goyal 2017-02-16 11:18:15 +05:30
parent 8aec078d00
commit 796df81638

View File

@ -1092,11 +1092,15 @@ class SpellCheck(Dialog):
in_user_dictionary = dictionaries.word_in_user_dictionary(*w) in_user_dictionary = dictionaries.word_in_user_dictionary(*w)
suggestions = dictionaries.suggestions(*w) suggestions = dictionaries.suggestions(*w)
self.suggested_list.clear() self.suggested_list.clear()
word_suggested = False
for i, s in enumerate(suggestions): for i, s in enumerate(suggestions):
item = QListWidgetItem(s, self.suggested_list) item = QListWidgetItem(s, self.suggested_list)
if i == 0: if i == 0:
self.suggested_list.setCurrentItem(item) self.suggested_list.setCurrentItem(item)
self.suggested_word.setText(s) self.suggested_word.setText(s)
word_suggested = True
if not word_suggested:
self.suggested_word.setText(current_word)
prefix = b.unign_text if ignored else b.ign_text prefix = b.unign_text if ignored else b.ign_text
b.setText(prefix + ' ' + current_word) b.setText(prefix + ' ' + current_word)