Merge branch master into dev

This commit is contained in:
Francesco Abbate 2021-05-26 07:39:53 +02:00
commit 63a613fe17
6 changed files with 19 additions and 8 deletions

View File

@ -30,7 +30,7 @@ Under very specific situations the application was crashing due to invalid memor
Add documentation for keymap binding, thanks to @Janis-Leuenberger.
Added a contibutors page in `doc/contributors.md`.
Added a contributors page in `doc/contributors.md`.
### 1.16.9

View File

@ -89,10 +89,15 @@ command.add(nil, {
local view = core.active_view
if view.doc and view.doc.abs_filename then
local dirname, filename = view.doc.abs_filename:match("(.*)[/\\](.+)$")
core.command_view:set_text(core.normalize_to_project_dir(dirname) .. PATHSEP)
if dirname then
dirname = core.normalize_to_project_dir(dirname)
local text = dirname == core.project_dir and "" or common.home_encode(dirname) .. PATHSEP
core.command_view:set_text(text)
end
end
core.command_view:enter("Open File", function(text)
core.root_view:open_doc(core.open_doc(common.home_expand(text)))
local filename = system.absolute_path(common.home_expand(text))
core.root_view:open_doc(core.open_doc(filename))
end, function (text)
return common.home_encode_list(common.path_suggest(common.home_expand(text)))
end, nil, function(text)

View File

@ -348,7 +348,7 @@ local commands = {
["doc:save-as"] = function()
if doc().filename then
core.command_view:set_text(doc().filename)
elseif core.last_active_view then
elseif core.last_active_view and core.last_active_view.doc 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

View File

@ -212,7 +212,9 @@ end
function common.home_encode(text)
if HOME and string.find(text, HOME, 1, true) == 1 then
local dir_pos = #HOME + 1
if string.find(text, PATHSEP, dir_pos, true) == dir_pos then
-- ensure we don't replace if the text is just "$HOME" or "$HOME/" so
-- it must have a "/" following the $HOME and some characters following.
if string.find(text, PATHSEP, dir_pos, true) == dir_pos and #text > dir_pos then
return "~" .. text:sub(dir_pos)
end
end

View File

@ -1025,7 +1025,8 @@ end
core.add_save_hook(function(filename)
local doc = core.active_view.doc
if doc and doc:is(Doc) and doc.abs_filename == USERDIR .. PATHSEP .. "init.lua" then
local user_filename = system.absolute_path(USERDIR .. PATHSEP .. "init.lua")
if doc and doc:is(Doc) and doc.abs_filename == user_filename then
core.reload_module("core.style")
core.load_user_directory()
end

View File

@ -15,9 +15,12 @@
<key>NSHighResolutionCapable</key>
<true/>
<key>MinimumOSVersion</key><string>10.13</string>
<key>NSDocumentsFolderUsageDescription</key><string>To access, edit and index your projects.</string>
<key>NSDesktopFolderUsageDescription</key><string>To access, edit and index your projects.</string>
<key>NSDownloadsFolderUsageDescription</key><string>To access, edit and index your projects.</string>
<key>CFBundleShortVersionString</key>
<string>1.16.5</string>
<string>1.16.10</string>
<key>NSHumanReadableCopyright</key>
<string>© 2019-2021 rxi franko</string>
<string>© 2019-2021 Francesco Abbate</string>
</dict>
</plist>