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:
Richard Li
2022-12-03 14:39:00 +11:00
committed by GitHub
parent 07149daa0c
commit 9d9c5711dc
3 changed files with 23 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
local notify = require "nvim-tree.notify"
local explorer_common = require "nvim-tree.explorer.common"
local M = {
SIGN_GROUP = "NvimTreeGitSigns",
@@ -75,16 +76,12 @@ local function warn_status(git_status)
)
end
local function show_git(node)
return node.git_status and (not node.open or M.git_show_on_open_dirs)
end
local function get_icons_(node)
local git_status = node.git_status
if not show_git(node) then
if not explorer_common.shows_git_status(node) then
return nil
end
local git_status = node.git_status
local icons = M.git_icons[git_status]
if not icons then
if not M.config.highlight_git then
@@ -141,7 +138,7 @@ end
local function get_highlight_(node)
local git_status = node.git_status
if not show_git(node) then
if not explorer_common.shows_git_status(node) then
return
end