Unified open and saving style. (#189)
This commit is contained in:
parent
85d0d684de
commit
e43f1b9df9
|
@ -88,7 +88,8 @@ command.add(nil, {
|
||||||
["core:open-file"] = function()
|
["core:open-file"] = function()
|
||||||
local view = core.active_view
|
local view = core.active_view
|
||||||
if view.doc and view.doc.abs_filename then
|
if view.doc and view.doc.abs_filename then
|
||||||
core.command_view:set_text(common.home_encode(view.doc.abs_filename))
|
local dirname, filename = view.doc.abs_filename:match("(.*)[/\\](.+)$")
|
||||||
|
core.command_view:set_text(core.normalize_to_project_dir(dirname) .. PATHSEP)
|
||||||
end
|
end
|
||||||
core.command_view:enter("Open File", function(text)
|
core.command_view:enter("Open File", function(text)
|
||||||
core.root_view:open_doc(core.open_doc(common.home_expand(text)))
|
core.root_view:open_doc(core.open_doc(common.home_expand(text)))
|
||||||
|
|
|
@ -299,6 +299,9 @@ local commands = {
|
||||||
["doc:save-as"] = function()
|
["doc:save-as"] = function()
|
||||||
if doc().filename then
|
if doc().filename then
|
||||||
core.command_view:set_text(doc().filename)
|
core.command_view:set_text(doc().filename)
|
||||||
|
elseif core.last_active_view 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
|
end
|
||||||
core.command_view:enter("Save As", function(filename)
|
core.command_view:enter("Save As", function(filename)
|
||||||
save(common.home_expand(filename))
|
save(common.home_expand(filename))
|
||||||
|
|
Loading…
Reference in New Issue