CoverBrowser: fix getting cached info (#10346)

reviewable/pr10360/r1
hius07 1 year ago committed by GitHub
parent b04639a9e6
commit fd8cb14c00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -61,7 +61,7 @@ function CoverMenu:updateCache(file, status, do_create, pages)
status = summary and summary.status
local highlight = doc_settings:readSetting("highlight")
local has_highlight = highlight and next(highlight) and true
self.cover_info_cache[file] = {pages, percent_finished, status, has_highlight}
self.cover_info_cache[file] = table.pack(pages, percent_finished, status, has_highlight) -- may be a sparse array
else
if self.cover_info_cache and self.cover_info_cache[file] then
if status then

@ -372,7 +372,8 @@ function ListMenuItem:update()
if DocSettings:hasSidecarFile(self.filepath) then
self.been_opened = true
self.menu:updateCache(self.filepath, nil, true, pages) -- create new cache entry if absent
pages, percent_finished, status, has_highlight = unpack(self.menu.cover_info_cache[self.filepath])
pages, percent_finished, status, has_highlight =
unpack(self.menu.cover_info_cache[self.filepath], 1, self.menu.cover_info_cache[self.filepath].n)
end
-- right widget, first line
local directory, filename = util.splitFilePathName(self.filepath) -- luacheck: no unused

@ -577,7 +577,8 @@ function MosaicMenuItem:update()
if DocSettings:hasSidecarFile(self.filepath) then
self.been_opened = true
self.menu:updateCache(self.filepath, nil, true, bookinfo.pages) -- create new cache entry if absent
dummy, percent_finished, status = unpack(self.menu.cover_info_cache[self.filepath])
dummy, percent_finished, status =
unpack(self.menu.cover_info_cache[self.filepath], 1, self.menu.cover_info_cache[self.filepath].n)
end
self.percent_finished = percent_finished
self.status = status

Loading…
Cancel
Save