fix(#2154): selection incorrect after find-file when renderer.group_empty (#2437)

This commit is contained in:
Alexander Courtis 2023-10-07 12:24:19 +11:00 committed by GitHub
parent e153d9f599
commit d8e495b235
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,8 +44,10 @@ function M.fn(path)
return node.absolute_path == path_real or node.link_to == path_real return node.absolute_path == path_real or node.link_to == path_real
end) end)
:applier(function(node) :applier(function(node)
local incremented_line = false
if not node.group_next then if not node.group_next then
line = line + 1 line = line + 1
incremented_line = true
end end
if vim.tbl_contains(absolute_paths_searched, node.absolute_path) then if vim.tbl_contains(absolute_paths_searched, node.absolute_path) then
@ -62,6 +64,9 @@ function M.fn(path)
end end
if #node.nodes == 0 then if #node.nodes == 0 then
core.get_explorer():expand(node) core.get_explorer():expand(node)
if node.group_next and incremented_line then
line = line - 1
end
end end
end end
end) end)