From d8f8788f3460b452388abc8f49022139cf3f7d77 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 1 Jan 2017 20:51:07 +0530 Subject: [PATCH] Fix Go to... not working --- src/pyj/read_book/goto.pyj | 4 ++-- src/pyj/read_book/toc.pyj | 2 +- src/pyj/read_book/view.pyj | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pyj/read_book/goto.pyj b/src/pyj/read_book/goto.pyj index e172cd46b9..0aef3d0902 100644 --- a/src/pyj/read_book/goto.pyj +++ b/src/pyj/read_book/goto.pyj @@ -18,9 +18,9 @@ def create_goto_list(onclick): id_map = get_toc_maps(toc)[1] before, after = get_border_nodes(toc, id_map) if after: - items.push(create_item(_('Next Section'), icon='caret-right', subtitle=after.title, action=onclick.bind(after.dest, after.frag))) + items.push(create_item(_('Next Section'), icon='caret-right', subtitle=after.title, action=onclick.bind(None, after.dest, after.frag))) if before: - items.push(create_item(_('Previous Section'), icon='caret-left', subtitle=before.title, action=onclick.bind(before.dest, before.frag))) + items.push(create_item(_('Previous Section'), icon='caret-left', subtitle=before.title, action=onclick.bind(None, before.dest, before.frag))) build_list(ans, items) return ans diff --git a/src/pyj/read_book/toc.pyj b/src/pyj/read_book/toc.pyj index a6a384feaf..b0f3328d50 100644 --- a/src/pyj/read_book/toc.pyj +++ b/src/pyj/read_book/toc.pyj @@ -50,7 +50,7 @@ def get_border_nodes(toc, id_map): nonlocal prev, before, after if node.dest: if spine_before[node.dest]: - prev = node.dest + prev = node elif spine_after[node.dest]: if not before: before = prev diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index b47f0e682b..77624eb354 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -6,7 +6,7 @@ from book_list.globals import get_session_data, get_boss from dom import set_css, add_extra_css, build_rule, svgicon from elementmaker import E from gettext import gettext as _ -from read_book.globals import messenger, iframe_id, current_book +from read_book.globals import messenger, iframe_id, current_book, set_current_spine_item from read_book.resources import load_resources from read_book.overlay import Overlay from read_book.prefs.colors import resolve_color_scheme @@ -269,6 +269,7 @@ class View: self.show_loading() spine = self.book.manifest.spine idx = spine.indexOf(name) + set_current_spine_item(name) if idx > -1: self.currently_showing.bookpos = 'epubcfi(/{})'.format(2 * (idx +1)) self.set_margins()