From 1a4faad17c6eeacdb92356e0920954a612230a38 Mon Sep 17 00:00:00 2001 From: poire-z Date: Wed, 13 Mar 2019 13:01:22 +0100 Subject: [PATCH] cre: Footnotes popup: fix markers disappearing too early When following a footnote popup, the highlighted link delayed clearing (when the link is hidden by the popup) would clear the margin marker on the target page too early. --- frontend/apps/reader/modules/readerlink.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/apps/reader/modules/readerlink.lua b/frontend/apps/reader/modules/readerlink.lua index 988a483f0..bcbcd48a9 100644 --- a/frontend/apps/reader/modules/readerlink.lua +++ b/frontend/apps/reader/modules/readerlink.lua @@ -1062,9 +1062,15 @@ function ReaderLink:showAsFootnotePopup(link, neglect_current_location) UIManager:setDirty(self.dialog, "ui") close_callback = function(footnote_height) -- remove this highlight (actually all) on close + local highlight_page = self.ui.document:getCurrentPage() local clear_highlight = function() self.ui.document:highlightXPointer() - UIManager:setDirty(self.dialog, "ui") + -- Only refresh if we stayed on the same page, otherwise + -- this could remove too early a marker on the target page + -- after this footnote is followed + if self.ui.document:getCurrentPage() == highlight_page then + UIManager:setDirty(self.dialog, "ui") + end end if footnote_height then -- If the link was hidden by the footnote popup,