mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Fix pressing F8 to jump to next misspelled word not working after last word in current file
This commit is contained in:
parent
c3925db827
commit
c615bf8b1c
@ -1159,7 +1159,7 @@ class Boss(QObject):
|
|||||||
# Go to the next spelling error
|
# Go to the next spelling error
|
||||||
ed = self.gui.central.current_editor
|
ed = self.gui.central.current_editor
|
||||||
name = editor_name(ed)
|
name = editor_name(ed)
|
||||||
find_next_error(ed, name, self.gui, self.show_editor, self.edit_file)
|
find_next_error(ed, name, self.gui, self.show_editor, self.edit_file, self.close_editor)
|
||||||
|
|
||||||
def word_change_requested(self, w, new_word):
|
def word_change_requested(self, w, new_word):
|
||||||
if self.commit_all_editors_to_container():
|
if self.commit_all_editors_to_container():
|
||||||
|
@ -1376,7 +1376,7 @@ def find_next(word, locations, current_editor, current_editor_name,
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def find_next_error(current_editor, current_editor_name, gui_parent, show_editor, edit_file):
|
def find_next_error(current_editor, current_editor_name, gui_parent, show_editor, edit_file, close_editor):
|
||||||
files = get_checkable_file_names(current_container())[0]
|
files = get_checkable_file_names(current_container())[0]
|
||||||
if current_editor_name not in files:
|
if current_editor_name not in files:
|
||||||
current_editor_name = None
|
current_editor_name = None
|
||||||
@ -1391,12 +1391,18 @@ def find_next_error(current_editor, current_editor_name, gui_parent, show_editor
|
|||||||
from_cursor = True
|
from_cursor = True
|
||||||
current_editor_name = None
|
current_editor_name = None
|
||||||
ed = editors.get(file_name, None)
|
ed = editors.get(file_name, None)
|
||||||
|
needs_close = False
|
||||||
if ed is None:
|
if ed is None:
|
||||||
edit_file(file_name)
|
edit_file(file_name)
|
||||||
ed = editors[file_name]
|
ed = editors[file_name]
|
||||||
|
needs_close = True
|
||||||
|
if hasattr(ed, 'highlighter'):
|
||||||
|
ed.highlighter.join()
|
||||||
if ed.editor.find_next_spell_error(from_cursor=from_cursor):
|
if ed.editor.find_next_spell_error(from_cursor=from_cursor):
|
||||||
show_editor(file_name)
|
show_editor(file_name)
|
||||||
return True
|
return True
|
||||||
|
elif needs_close:
|
||||||
|
close_editor(file_name)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user