mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #332 from tigran123/master
Jump history in crereader loses the last position.
This commit is contained in:
@@ -636,12 +636,29 @@ function CREReader:adjustCreReaderCommands()
|
||||
self.commands:add(KEY_BACK, nil, "Back",
|
||||
"go backward in jump history",
|
||||
function(self)
|
||||
local prev_jump_no = self.jump_history.cur - 1
|
||||
local prev_jump_no = 0
|
||||
local need_refresh = false
|
||||
if self.jump_history.cur > #self.jump_history then
|
||||
-- addJump() will cause a "Retrieving TOC..." msg, so we'll
|
||||
-- need to redraw the page after our own
|
||||
-- ifo msg "Already first jump!" below
|
||||
if not self.toc then need_refresh = true end
|
||||
|
||||
-- if cur points to head, put current page in history
|
||||
self:addJump(self.doc:getXPointer())
|
||||
prev_jump_no = self.jump_history.cur - 2
|
||||
else
|
||||
prev_jump_no = self.jump_history.cur - 1
|
||||
end
|
||||
|
||||
if prev_jump_no >= 1 then
|
||||
self.jump_history.cur = prev_jump_no
|
||||
self:goto(self.jump_history[prev_jump_no].page, true, "xpointer")
|
||||
else
|
||||
showInfoMsgWithDelay("Already first jump!", 2000, 1)
|
||||
if need_refresh then
|
||||
self:redrawCurrentPage()
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user