mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
f8c1dd46bb
commit
f07c4a91dc
@ -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
|
||||||
new_word = split_into_words(new_word)[0]
|
try:
|
||||||
|
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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user