From 3f4cb8bdda6df0cd29eb4293dbd5977c0bb43608 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sun, 2 Mar 2025 12:43:52 +0100 Subject: [PATCH] Use Path directly instead of GetPath getter inside the filetree package --- pkg/gui/filetree/node.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/gui/filetree/node.go b/pkg/gui/filetree/node.go index dddafde27..c5ccc4349 100644 --- a/pkg/gui/filetree/node.go +++ b/pkg/gui/filetree/node.go @@ -89,7 +89,7 @@ func (self *Node[T]) SortChildren() { return 1 } - return strings.Compare(a.GetPath(), b.GetPath()) + return strings.Compare(a.Path, b.Path) }) // TODO: think about making this in-place @@ -159,7 +159,7 @@ func (self *Node[T]) EveryFile(test func(*T) bool) bool { func (self *Node[T]) Flatten(collapsedPaths *CollapsedPaths) []*Node[T] { result := []*Node[T]{self} - if len(self.Children) > 0 && !collapsedPaths.IsCollapsed(self.GetPath()) { + if len(self.Children) > 0 && !collapsedPaths.IsCollapsed(self.Path) { result = append(result, lo.FlatMap(self.Children, func(child *Node[T], _ int) []*Node[T] { return child.Flatten(collapsedPaths) })...) @@ -185,7 +185,7 @@ func (self *Node[T]) getNodeAtIndexAux(index int, collapsedPaths *CollapsedPaths return self, offset } - if !collapsedPaths.IsCollapsed(self.GetPath()) { + if !collapsedPaths.IsCollapsed(self.Path) { for _, child := range self.Children { foundNode, offsetChange := child.getNodeAtIndexAux(index-offset, collapsedPaths) offset += offsetChange @@ -201,11 +201,11 @@ func (self *Node[T]) getNodeAtIndexAux(index int, collapsedPaths *CollapsedPaths func (self *Node[T]) GetIndexForPath(path string, collapsedPaths *CollapsedPaths) (int, bool) { offset := 0 - if self.GetPath() == path { + if self.Path == path { return offset, true } - if !collapsedPaths.IsCollapsed(self.GetPath()) { + if !collapsedPaths.IsCollapsed(self.Path) { for _, child := range self.Children { offsetChange, found := child.GetIndexForPath(path, collapsedPaths) offset += offsetChange + 1 @@ -225,7 +225,7 @@ func (self *Node[T]) Size(collapsedPaths *CollapsedPaths) int { output := 1 - if !collapsedPaths.IsCollapsed(self.GetPath()) { + if !collapsedPaths.IsCollapsed(self.Path) { for _, child := range self.Children { output += child.Size(collapsedPaths) }