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)

This commit is contained in:
Kovid Goyal 2018-01-02 09:51:29 +05:30
parent 4375a580dc
commit 589214ce67
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -17,12 +17,11 @@ def update_visible_toc_nodes(visible_anchors):
update_visible_toc_nodes.data = {} update_visible_toc_nodes.data = {}
def iter_toc_nodes(node, callback): def iter_toc_descendants(node, callback):
if callback(node):
return
for child in node.children: for child in node.children:
if callback(child): if callback(child):
return return
iter_toc_descendants(child, callback)
def get_border_nodes(toc, id_map): def get_border_nodes(toc, id_map):
@ -47,7 +46,7 @@ def get_border_nodes(toc, id_map):
else: else:
which[name] = True which[name] = True
prev = None prev = None
iter_toc_nodes(toc, def(node): iter_toc_descendants(toc, def(node):
nonlocal prev, before, after nonlocal prev, before, after
if node.dest: if node.dest:
if spine_before[node.dest]: if spine_before[node.dest]: