Update statusline immediately when toggling a bookmark (#6872)

reviewable/pr6884/r1
zwim 4 years ago committed by GitHub
parent 1468646aa5
commit f24d6f8aea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -182,6 +182,7 @@ function ReaderBookmark:onToggleBookmark()
pn_or_xp = self.ui.document:getXPointer()
end
self:toggleBookmark(pn_or_xp)
self.view.footer:onUpdateFooter(true)
self.ui:handleEvent(Event:new("SetDogearVisibility",
not self.view.dogear_visible))
UIManager:setDirty(self.view.dialog, "ui")
@ -418,6 +419,7 @@ function ReaderBookmark:addBookmark(item)
end
end
table.insert(self.bookmarks, _middle + direction, item)
self.view.footer:onUpdateFooter(true)
end
-- binary search of sorted bookmarks
@ -460,7 +462,9 @@ function ReaderBookmark:removeBookmark(item)
_middle = math.floor((_start + _end)/2)
local v = self.bookmarks[_middle]
if item.datetime == v.datetime and item.page == v.page then
return table.remove(self.bookmarks, _middle)
table.remove(self.bookmarks, _middle)
self.view.footer:onUpdateFooter(true)
return
elseif self:isBookmarkInPageOrder(item, v) then
_end = _middle - 1
else
@ -475,7 +479,9 @@ function ReaderBookmark:removeBookmark(item)
for i=1, #self.bookmarks do
local v = self.bookmarks[i]
if item.datetime == v.datetime and item.page == v.page then
return table.remove(self.bookmarks, i)
table.remove(self.bookmarks, i)
self.view.footer:onUpdateFooter(true)
return
end
end
logger.warn("removeBookmark: full scan search didn't find bookmark")

Loading…
Cancel
Save