From 589214ce671ca45a2c64ca385359c46d9cb93c3e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 2 Jan 2018 09:51:29 +0530 Subject: [PATCH] Browser viewer: Fix got next/previos section actions not working when the sections are in different individual HTML files. Fixes #1740333 [[Browser Viewer] problem with swipe](https://bugs.launchpad.net/calibre/+bug/1740333) --- src/pyj/read_book/toc.pyj | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pyj/read_book/toc.pyj b/src/pyj/read_book/toc.pyj index 67d1c5f186..57809c09f1 100644 --- a/src/pyj/read_book/toc.pyj +++ b/src/pyj/read_book/toc.pyj @@ -17,12 +17,11 @@ def update_visible_toc_nodes(visible_anchors): update_visible_toc_nodes.data = {} -def iter_toc_nodes(node, callback): - if callback(node): - return +def iter_toc_descendants(node, callback): for child in node.children: if callback(child): return + iter_toc_descendants(child, callback) def get_border_nodes(toc, id_map): @@ -47,7 +46,7 @@ def get_border_nodes(toc, id_map): else: which[name] = True prev = None - iter_toc_nodes(toc, def(node): + iter_toc_descendants(toc, def(node): nonlocal prev, before, after if node.dest: if spine_before[node.dest]: