Skip to content

Commit 84126d3

Browse files
committed
fix: retrieve last group node when iterating for siblings or parent
1 parent 71122d7 commit 84126d3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lua/nvim-tree/lib.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,14 @@ local function get_line_from_node(node, find_parent)
8585
local line = 2
8686
local function iter(entries, recursive)
8787
for _, entry in ipairs(entries) do
88-
if node_path:match('^'..entry.match_path..'$') ~= nil then
88+
local n = M.get_last_group_node(entry)
89+
if node_path:match('^'..n.match_path..'$') ~= nil then
8990
return line, entry
9091
end
9192

9293
line = line + 1
93-
if entry.open == true and recursive then
94-
local _, child = iter(entry.entries, recursive)
94+
if n.open == true and recursive then
95+
local _, child = iter(n.entries, recursive)
9596
if child ~= nil then return line, child end
9697
end
9798
end

0 commit comments

Comments
 (0)