diff --git a/changelog.md b/changelog.md
index e9566a59..afb92d26 100644
--- a/changelog.md
+++ b/changelog.md
@@ -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
diff --git a/data/core/commands/core.lua b/data/core/commands/core.lua
index 16f52a87..a7d9030d 100644
--- a/data/core/commands/core.lua
+++ b/data/core/commands/core.lua
@@ -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)
diff --git a/data/core/commands/doc.lua b/data/core/commands/doc.lua
index aecc80be..d1f1b261 100644
--- a/data/core/commands/doc.lua
+++ b/data/core/commands/doc.lua
@@ -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
diff --git a/data/core/common.lua b/data/core/common.lua
index 1d919bc2..06ef2880 100644
--- a/data/core/common.lua
+++ b/data/core/common.lua
@@ -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
diff --git a/data/core/init.lua b/data/core/init.lua
index f1cd9367..cb4abbfa 100644
--- a/data/core/init.lua
+++ b/data/core/init.lua
@@ -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
diff --git a/dev-utils/Info.plist b/dev-utils/Info.plist
index 75591560..cc369cd0 100644
--- a/dev-utils/Info.plist
+++ b/dev-utils/Info.plist
@@ -15,9 +15,12 @@
NSHighResolutionCapable
MinimumOSVersion10.13
+ NSDocumentsFolderUsageDescriptionTo access, edit and index your projects.
+ NSDesktopFolderUsageDescriptionTo access, edit and index your projects.
+ NSDownloadsFolderUsageDescriptionTo access, edit and index your projects.
CFBundleShortVersionString
- 1.16.5
+ 1.16.10
NSHumanReadableCopyright
- © 2019-2021 rxi franko
+ © 2019-2021 Francesco Abbate