Skip to content

Commit 1045776

Browse files
committed
Fix: make isDescendentOfSelectedNodes work for the root item
The root item's path is ".", and the path of a file at top level is "./file". When using GetPath, this gives us "." and "file", respectively, and isDescendentOfSelectedNodes would return false for these. Working with the internal paths (i.e. without stripping the leading "./") fixes this.
1 parent b8111e7 commit 1045776

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/gui/controllers/files_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,14 +1221,14 @@ func normalisedSelectedNodes(selectedNodes []*filetree.FileNode) []*filetree.Fil
12211221
}
12221222

12231223
func isDescendentOfSelectedNodes(node *filetree.FileNode, selectedNodes []*filetree.FileNode) bool {
1224-
nodePath := node.GetPath()
1224+
nodePath := node.GetInternalPath()
12251225

12261226
for _, selectedNode := range selectedNodes {
12271227
if selectedNode.IsFile() {
12281228
continue
12291229
}
12301230

1231-
selectedNodePath := selectedNode.GetPath()
1231+
selectedNodePath := selectedNode.GetInternalPath()
12321232

12331233
if strings.HasPrefix(nodePath, selectedNodePath+"/") {
12341234
return true

0 commit comments

Comments
 (0)