Split out reload functionality to actual document, and added in a thread to check the document, in the cases where it wouldn't be covered by dirwatch.
This commit is contained in:
@@ -466,6 +466,10 @@ local commands = {
|
||||
command.perform("doc:save-as")
|
||||
end
|
||||
end,
|
||||
|
||||
["doc:reload"] = function()
|
||||
doc():reload()
|
||||
end,
|
||||
|
||||
["file:rename"] = function()
|
||||
local old_filename = doc().filename
|
||||
|
||||
@@ -80,6 +80,16 @@ function Doc:load(filename)
|
||||
end
|
||||
|
||||
|
||||
function Doc:reload()
|
||||
if self.filename then
|
||||
local sel = { self:get_selection() }
|
||||
self:load(self.filename)
|
||||
self:clean()
|
||||
self:set_selection(table.unpack(sel))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function Doc:save(filename, abs_filename)
|
||||
if not filename then
|
||||
assert(self.filename, "no filename set to default to")
|
||||
|
||||
Reference in New Issue
Block a user