Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
committed by
GitHub
parent
74996b8626
commit
d8b154c5f0
@@ -44,7 +44,9 @@ function M.fn(path)
|
||||
return node.absolute_path == path_real or node.link_to == path_real
|
||||
end)
|
||||
:applier(function(node)
|
||||
line = line + 1
|
||||
if not node.group_next then
|
||||
line = line + 1
|
||||
end
|
||||
|
||||
if vim.tbl_contains(absolute_paths_searched, node.absolute_path) then
|
||||
return
|
||||
@@ -55,14 +57,16 @@ function M.fn(path)
|
||||
local link_match = node.link_to and vim.startswith(path_real, node.link_to .. utils.path_separator)
|
||||
|
||||
if abs_match or link_match then
|
||||
node.open = true
|
||||
if not node.group_next then
|
||||
node.open = true
|
||||
end
|
||||
if #node.nodes == 0 then
|
||||
core.get_explorer():expand(node)
|
||||
end
|
||||
end
|
||||
end)
|
||||
:recursor(function(node)
|
||||
return node.open and node.nodes
|
||||
return node.group_next and { node.group_next } or (node.open and #node.nodes > 0 and node.nodes)
|
||||
end)
|
||||
:iterate()
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ local renderer = require "nvim-tree.renderer"
|
||||
local view = require "nvim-tree.view"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local core = require "nvim-tree.core"
|
||||
local lib = require "nvim-tree.lib"
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -9,18 +10,13 @@ function M.fn(should_close)
|
||||
should_close = should_close or false
|
||||
|
||||
return function(node)
|
||||
node = lib.get_last_group_node(node)
|
||||
if should_close and node.open then
|
||||
node.open = false
|
||||
return renderer.draw()
|
||||
end
|
||||
|
||||
local parent = node.parent
|
||||
|
||||
if renderer.config.group_empty and parent then
|
||||
while parent.parent and parent.parent.group_next do
|
||||
parent = parent.parent
|
||||
end
|
||||
end
|
||||
local parent = utils.get_parent_of_group(node).parent
|
||||
|
||||
if not parent or not parent.parent then
|
||||
return view.set_cursor { 1, 0 }
|
||||
|
||||
@@ -36,7 +36,7 @@ function M.fn(keep_buffers)
|
||||
end
|
||||
end)
|
||||
:recursor(function(n)
|
||||
return n.nodes
|
||||
return n.group_next and { n.group_next } or n.nodes
|
||||
end)
|
||||
:iterate()
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ local core = require "nvim-tree.core"
|
||||
local renderer = require "nvim-tree.renderer"
|
||||
local Iterator = require "nvim-tree.iterators.node-iterator"
|
||||
local notify = require "nvim-tree.notify"
|
||||
local lib = require "nvim-tree.lib"
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -15,6 +16,7 @@ local function to_lookup_table(list)
|
||||
end
|
||||
|
||||
local function expand(node)
|
||||
node = lib.get_last_group_node(node)
|
||||
node.open = true
|
||||
if #node.nodes == 0 then
|
||||
core.get_explorer():expand(node)
|
||||
@@ -45,7 +47,8 @@ local function gen_iterator()
|
||||
end
|
||||
end)
|
||||
:recursor(function(node)
|
||||
return expansion_count < M.MAX_FOLDER_DISCOVERY and node.open and node.nodes
|
||||
return expansion_count < M.MAX_FOLDER_DISCOVERY
|
||||
and (node.group_next and { node.group_next } or (node.open and node.nodes))
|
||||
end)
|
||||
:iterate()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user