Two trivial optimizations

1. Comment out re-calculation of parameters to adjust for the case when
the user changed screen orientation, because we force portrait mode on
document close. I left a comment explaining this, so we can uncomment
this code if we choose to not force portrait mode on document close in
thefuture.
2. Don't re-sort the list if the file does not exist.
This predicts the most likely scenario, namely that the user
will choose to delete this stale history entry.
And even if he chooses NOT to delete it, placing a stale entry
to the top of the list contradicts our logic because the
non-existent file was never opened.
Tigran Aivazian 12 years ago
parent 722ddc96f9
commit 4bc9f37b49

@ -230,18 +230,20 @@ function FileHistory:addAllCommands()
file_full_path = file_entry.dir .. "/" .. file_entry.name
if FileExists(file_full_path) then
openFile(file_full_path)
--reset height and item index if screen has been rotated
--[[
-- reset height and item index if screen has been rotated
-- not needed because we force portrait mode on document close
local item_no = self.perpage * (self.page - 1) + self.current
self.perpage = math.floor(G_height / self.spacing) - 2
self.current = item_no % self.perpage
self.page = math.floor(item_no / self.perpage) + 1
--]]
self:init()
self:setSearchResult(self.keywords)
self.pagedirty = true
else
InfoMessage:inform("File does not exist ", DINFO_DELAY, 1, MSG_ERROR)
end
self:init()
self:setSearchResult(self.keywords)
self.pagedirty = true
end
)
self.commands:add(KEY_DEL, nil, "Del",

Loading…
Cancel
Save