Edit Book: Fix an error in the spell checker when trying to replace words with nothing (i.e. deleting words)

This commit is contained in:
Kovid Goyal 2016-11-08 08:32:19 +05:30
parent f8c1dd46bb
commit f07c4a91dc

View File

@ -758,7 +758,10 @@ class WordsModel(QAbstractTableModel):
def replace_word(self, w, new_word): def replace_word(self, w, new_word):
# Hack to deal with replacement words that are actually multiple words, # Hack to deal with replacement words that are actually multiple words,
# ignore all words except the first # ignore all words except the first
try:
new_word = split_into_words(new_word)[0] new_word = split_into_words(new_word)[0]
except IndexError:
new_word = ''
for location in self.words[w]: for location in self.words[w]:
location.replace(new_word) location.replace(new_word)
if w[0] == new_word: if w[0] == new_word: