From 5d82ffe984a4d3105a5315bc3ccb0dbe47c9021d Mon Sep 17 00:00:00 2001 From: Tigran Aivazian Date: Wed, 26 Sep 2012 16:05:07 +0100 Subject: [PATCH] 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. --- unireader.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/unireader.lua b/unireader.lua index ed8393e16..933772603 100644 --- a/unireader.lua +++ b/unireader.lua @@ -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",