Merge branch 'master' into dev

This commit is contained in:
Francesco Abbate
2021-02-17 23:57:02 +01:00
6 changed files with 56 additions and 22 deletions
+3 -17
View File
@@ -7,17 +7,9 @@ local LogView = require "core.logview"
local fullscreen = false
local function home_encode_list(paths)
local t = {}
for i = 1, #paths do
t[i] = common.home_encode(paths[i])
end
return t
end
local function suggest_directory(text)
text = common.home_expand(text)
return home_encode_list(text == "" and core.recent_projects or common.dir_path_suggest(text))
return common.home_encode_list(text == "" and core.recent_projects or common.dir_path_suggest(text))
end
command.add(nil, {
@@ -95,7 +87,7 @@ command.add(nil, {
core.command_view:enter("Open File", function(text)
core.root_view:open_doc(core.open_doc(common.home_expand(text)))
end, function (text)
return home_encode_list(common.path_suggest(common.home_expand(text)))
return common.home_encode_list(common.path_suggest(common.home_expand(text)))
end)
end,
@@ -107,12 +99,6 @@ command.add(nil, {
["core:open-user-module"] = function()
local user_module_doc = core.open_doc(USERDIR .. "/init.lua")
if not user_module_doc then return end
local doc_save = user_module_doc.save
user_module_doc.save = function(self)
doc_save(self)
core.reload_module("core.style")
core.load_user_directory()
end
core.root_view:open_doc(user_module_doc)
end,
@@ -184,7 +170,7 @@ command.add(nil, {
end
end, function(text)
text = common.home_expand(text)
return home_encode_list(common.dir_list_suggest(text, dir_list))
return common.home_encode_list(common.dir_list_suggest(text, dir_list))
end)
end,
})
+5 -2
View File
@@ -67,6 +67,7 @@ end
local function save(filename)
doc():save(filename)
core.on_doc_save(filename)
core.log("Saved \"%s\"", doc().filename)
end
@@ -297,8 +298,10 @@ local commands = {
core.command_view:set_text(doc().filename)
end
core.command_view:enter("Save As", function(filename)
save(filename)
end, common.path_suggest)
save(common.home_expand(filename))
end, function (text)
return common.home_encode_list(common.path_suggest(common.home_expand(text)))
end)
end,
["doc:save"] = function()