From 305c45f6727ef41bd20601f67994e6bc6ebf081f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 5 Feb 2023 09:40:01 +0530 Subject: [PATCH] Edit book: Spell Check dialog: Fix second word not getting selected when after first word is fixed --- src/calibre/gui2/tweak_book/spell.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/spell.py b/src/calibre/gui2/tweak_book/spell.py index 695f9a5794..0e719ed80a 100644 --- a/src/calibre/gui2/tweak_book/spell.py +++ b/src/calibre/gui2/tweak_book/spell.py @@ -1284,6 +1284,7 @@ class SpellCheck(Dialog): self.change_requested.emit(w, new_word) def do_change_word(self, w, new_word): + current_row = self.words_view.currentIndex().row() self.undo_cache.clear() changed_files = replace_word(current_container(), new_word, self.words_model.words[w], w[1], undo_cache=self.undo_cache) if changed_files: @@ -1292,7 +1293,7 @@ class SpellCheck(Dialog): row = self.words_model.row_for_word(w) if row == -1: row = self.words_view.currentIndex().row() - if row < self.words_model.rowCount() - 1: + if row < self.words_model.rowCount() - 1 and current_row > 0: row += 1 if row > -1: self.words_view.highlight_row(row)