From 84126d3eb5614b6444a980679cca04240a0e91e9 Mon Sep 17 00:00:00 2001 From: kiyan Date: Sun, 12 Sep 2021 14:04:41 +0200 Subject: [PATCH] fix: retrieve last group node when iterating for siblings or parent --- lua/nvim-tree/lib.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/nvim-tree/lib.lua b/lua/nvim-tree/lib.lua index ab4a7dd6..e97608a1 100644 --- a/lua/nvim-tree/lib.lua +++ b/lua/nvim-tree/lib.lua @@ -85,13 +85,14 @@ local function get_line_from_node(node, find_parent) local line = 2 local function iter(entries, recursive) for _, entry in ipairs(entries) do - if node_path:match('^'..entry.match_path..'$') ~= nil then + local n = M.get_last_group_node(entry) + if node_path:match('^'..n.match_path..'$') ~= nil then return line, entry end line = line + 1 - if entry.open == true and recursive then - local _, child = iter(entry.entries, recursive) + if n.open == true and recursive then + local _, child = iter(n.entries, recursive) if child ~= nil then return line, child end end end