fix: correct index in movement actions (#1058)

This commit is contained in:
Andreas Bissinger
2022-03-09 09:03:22 +01:00
committed by GitHub
parent 08c57660a7
commit d5a12ac9db
5 changed files with 13 additions and 15 deletions

View File

@@ -56,7 +56,9 @@ function M.parent_node(should_close)
parent.open = false
altered_tree = true
end
line = view.View.hide_root_folder and line - 1 or line
if not view.is_root_folder_visible(TreeExplorer) then
line = line - 1
end
view.set_cursor { line, 0 }
end
@@ -107,6 +109,9 @@ function M.sibling(direction)
local target_node = parent.nodes[index]
line, _ = get_line_from_node(target_node)(TreeExplorer.nodes, true)
if not view.is_root_folder_visible(TreeExplorer) then
line = line - 1
end
view.set_cursor { line, 0 }
end
end