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.
This commit is contained in:
poire-z
2019-03-13 13:01:22 +01:00
parent 1945e181c5
commit 1a4faad17c

View File

@@ -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,