From 67ed07db668a00290299fc8dbf87512f69c65e3b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 25 Apr 2020 18:11:00 +0530 Subject: [PATCH] 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) --- src/pyj/read_book/iframe.pyj | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/pyj/read_book/iframe.pyj b/src/pyj/read_book/iframe.pyj index 668553fcff..54a0610792 100644 --- a/src/pyj/read_book/iframe.pyj +++ b/src/pyj/read_book/iframe.pyj @@ -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()