mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: When jumping to a highlight using the highlights panel, the back button should return to position before jump. Fixes #1914921 [Highlights are not integrated with the navigation history](https://bugs.launchpad.net/calibre/+bug/1914921)
This commit is contained in:
parent
e723f56973
commit
2e0b2d1573
@ -1075,12 +1075,12 @@ class View:
|
|||||||
def on_scroll_to_anchor(self, data):
|
def on_scroll_to_anchor(self, data):
|
||||||
self.show_name(data.name, initial_position={'type':'anchor', 'anchor':data.frag, 'replace_history':False})
|
self.show_name(data.name, initial_position={'type':'anchor', 'anchor':data.frag, 'replace_history':False})
|
||||||
|
|
||||||
def goto_cfi(self, bookpos):
|
def goto_cfi(self, bookpos, add_to_history):
|
||||||
cfiname, internal_cfi = self.parse_cfi(bookpos, self.book)
|
cfiname, internal_cfi = self.parse_cfi(bookpos, self.book)
|
||||||
if cfiname and internal_cfi:
|
if cfiname and internal_cfi:
|
||||||
# replace_history has to be true here otherwise forward does not
|
# Note that goto_cfi is used by back() so it must not add to
|
||||||
# work after back, as back uses goto_cfi
|
# history by default, otherwise forward() will not work
|
||||||
pos = {'replace_history': True}
|
pos = {'replace_history': not add_to_history}
|
||||||
name = cfiname
|
name = cfiname
|
||||||
pos.type, pos.cfi = 'cfi', internal_cfi
|
pos.type, pos.cfi = 'cfi', internal_cfi
|
||||||
self.show_name(name, initial_position=pos)
|
self.show_name(name, initial_position=pos)
|
||||||
@ -1386,4 +1386,4 @@ class View:
|
|||||||
elif which is 'goto':
|
elif which is 'goto':
|
||||||
cfi = self.annotations_manager.cfi_for_highlight(uuid, spine_index)
|
cfi = self.annotations_manager.cfi_for_highlight(uuid, spine_index)
|
||||||
if cfi:
|
if cfi:
|
||||||
self.goto_cfi(cfi)
|
self.goto_cfi(cfi, True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user