Viewer: Fix a regression that broke searching in flow mode. Fixes #1874877 [In the viewer search when a value is found receive and Uncaught RangerError](https://bugs.launchpad.net/calibre/+bug/1874877)

This commit is contained in:
Kovid Goyal 2020-04-25 18:11:00 +05:30
parent d276e5be45
commit 67ed07db66
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -222,6 +222,7 @@ class IframeBoss:
self.anchor_funcs = flow_anchor_funcs
self.auto_scroll_action = flow_auto_scroll_action
self.scroll_to_extend_annotation = flow_annotation_scroll
self.ensure_selection_visible = ensure_selection_visible
paged_auto_scroll_action('stop')
else:
self.do_layout = paged_layout
@ -233,6 +234,7 @@ class IframeBoss:
self.anchor_funcs = paged_anchor_funcs
self.auto_scroll_action = paged_auto_scroll_action
self.scroll_to_extend_annotation = paged_annotation_scroll
self.ensure_selection_visible = snap_to_selection
flow_auto_scroll_action('stop')
update_settings(data.settings)
self.keyboard_shortcut_map = create_shortcut_map(data.settings.keyboard_shortcuts)
@ -620,12 +622,6 @@ class IframeBoss:
if refnum?:
self.scroll_to_ref(refnum)
def ensure_selection_visible(self):
if current_layout_mode() is 'flow':
ensure_selection_visible()
else:
snap_to_selection()
def find(self, data, from_load):
if data.searched_in_spine:
window.getSelection().removeAllRanges()