1786 git next prev land on dirs (#1787)
* Filtered dir with git status that are open when show_on_open_dir is false * refactored for single source of truth of existence of git status on a node Putting `has_git_status()` in `explorer.common` because that's where node.status is constructed Or at least I think that's where it's constructed * 1786 semantic nit Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
@@ -10,9 +10,7 @@ local function get_dir_git_status(parent_ignored, status, absolute_path)
|
||||
return file_status
|
||||
end
|
||||
|
||||
if M.config.git.show_on_dirs then
|
||||
return status.dirs and status.dirs[absolute_path]
|
||||
end
|
||||
return status.dirs and status.dirs[absolute_path]
|
||||
end
|
||||
|
||||
local function get_git_status(parent_ignored, status, absolute_path)
|
||||
@@ -41,6 +39,22 @@ function M.update_git_status(node, parent_ignored, status)
|
||||
end
|
||||
end
|
||||
|
||||
function M.shows_git_status(node)
|
||||
if not node.git_status then
|
||||
-- status doesn't exist
|
||||
return false
|
||||
elseif not node.nodes then
|
||||
-- status exist and is a file
|
||||
return true
|
||||
elseif not node.open then
|
||||
-- status exist, is a closed dir
|
||||
return M.config.git.show_on_dirs
|
||||
else
|
||||
-- status exist, is a open dir
|
||||
return M.config.git.show_on_dirs and M.config.git.show_on_open_dirs
|
||||
end
|
||||
end
|
||||
|
||||
function M.node_destroy(node)
|
||||
if not node then
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user