Delegate "lastfile" management to ReadHistory (#6128)
Simplify (and avoid edge cases) in other code by having ReadHistory manage the "lastfile" setting on add, remove, rename... Fixed a few other cases of things not updated.
This commit is contained in:
1 parent
48727a984b
commit
46221985a6
9 files changed
+75
-69
No files matched your search
@@ -72,16 +72,7 @@ function ReaderMenu:init()
|
||||
end
|
||||
|
||||
function ReaderMenu:getPreviousFile()
|
||||
local previous_file = nil
|
||||
local readhistory = require("readhistory")
|
||||
for i=2, #readhistory.hist do -- skip first one which is current book
|
||||
-- skip deleted items kept in history
|
||||
if lfs.attributes(readhistory.hist[i].file, "mode") == "file" then
|
||||
previous_file = readhistory.hist[i].file
|
||||
break
|
||||
end
|
||||
end
|
||||
return previous_file
|
||||
return require("readhistory"):getPreviousFile(self.ui.document.file)
|
||||
end
|
||||
|
||||
function ReaderMenu:onReaderReady()
|
||||
|
||||
Reference in new issue
Block a user