Fix missing check for filename when saving a file

Close #225
This commit is contained in:
Francesco Abbate 2021-05-27 18:53:31 +02:00
parent ee25e3c5f4
commit 34e38dd04a
1 changed files with 2 additions and 1 deletions

View File

@ -341,9 +341,10 @@ local commands = {
end,
["doc:save-as"] = function()
local last_doc = core.last_active_view and core.last_active_view.doc
if doc().filename then
core.command_view:set_text(doc().filename)
elseif core.last_active_view and core.last_active_view.doc then
elseif last_doc and last_doc.filename then
local dirname, filename = core.last_active_view.doc.abs_filename:match("(.*)[/\\](.+)$")
core.command_view:set_text(core.normalize_to_project_dir(dirname) .. PATHSEP)
end