mirror of
https://github.com/koreader/koreader
synced 2024-10-31 21:20:20 +00:00
Redraw current page if necessary on pressing Back
For PDF and DjVu files (but not for crereader) the command handler for "Back" key can call addJump() in order to avoid losing the top of the jump history on return. This (addJump()) can cause the TOC to be retrieved and the message "Retrieving TOC..." to be displayed. If this happens then we need to redraw the current page after displaying our own "Already first jump!" message.
This commit is contained in:
parent
0987c2826e
commit
5d82ffe984
@ -2261,7 +2261,13 @@ function UniReader:addAllCommands()
|
||||
"go backward in jump history",
|
||||
function(unireader)
|
||||
local prev_jump_no = 0
|
||||
local need_refresh = false
|
||||
if unireader.jump_history.cur > #unireader.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
|
||||
unireader:addJump(self.pageno)
|
||||
prev_jump_no = unireader.jump_history.cur - 2
|
||||
@ -2274,6 +2280,9 @@ function UniReader:addAllCommands()
|
||||
unireader:goto(unireader.jump_history[prev_jump_no].page, true)
|
||||
else
|
||||
showInfoMsgWithDelay("Already first jump!", 2000, 1)
|
||||
if need_refresh then
|
||||
unireader:redrawCurrentPage()
|
||||
end
|
||||
end
|
||||
end)
|
||||
self.commands:add(KEY_BACK,MOD_SHIFT,"Back",
|
||||
|
Loading…
Reference in New Issue
Block a user