Skip to content

Commit 3f4cb8b

Browse files
committed
Use Path directly instead of GetPath getter inside the filetree package
1 parent 53090b2 commit 3f4cb8b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pkg/gui/filetree/node.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func (self *Node[T]) SortChildren() {
8989
return 1
9090
}
9191

92-
return strings.Compare(a.GetPath(), b.GetPath())
92+
return strings.Compare(a.Path, b.Path)
9393
})
9494

9595
// TODO: think about making this in-place
@@ -159,7 +159,7 @@ func (self *Node[T]) EveryFile(test func(*T) bool) bool {
159159
func (self *Node[T]) Flatten(collapsedPaths *CollapsedPaths) []*Node[T] {
160160
result := []*Node[T]{self}
161161

162-
if len(self.Children) > 0 && !collapsedPaths.IsCollapsed(self.GetPath()) {
162+
if len(self.Children) > 0 && !collapsedPaths.IsCollapsed(self.Path) {
163163
result = append(result, lo.FlatMap(self.Children, func(child *Node[T], _ int) []*Node[T] {
164164
return child.Flatten(collapsedPaths)
165165
})...)
@@ -185,7 +185,7 @@ func (self *Node[T]) getNodeAtIndexAux(index int, collapsedPaths *CollapsedPaths
185185
return self, offset
186186
}
187187

188-
if !collapsedPaths.IsCollapsed(self.GetPath()) {
188+
if !collapsedPaths.IsCollapsed(self.Path) {
189189
for _, child := range self.Children {
190190
foundNode, offsetChange := child.getNodeAtIndexAux(index-offset, collapsedPaths)
191191
offset += offsetChange
@@ -201,11 +201,11 @@ func (self *Node[T]) getNodeAtIndexAux(index int, collapsedPaths *CollapsedPaths
201201
func (self *Node[T]) GetIndexForPath(path string, collapsedPaths *CollapsedPaths) (int, bool) {
202202
offset := 0
203203

204-
if self.GetPath() == path {
204+
if self.Path == path {
205205
return offset, true
206206
}
207207

208-
if !collapsedPaths.IsCollapsed(self.GetPath()) {
208+
if !collapsedPaths.IsCollapsed(self.Path) {
209209
for _, child := range self.Children {
210210
offsetChange, found := child.GetIndexForPath(path, collapsedPaths)
211211
offset += offsetChange + 1
@@ -225,7 +225,7 @@ func (self *Node[T]) Size(collapsedPaths *CollapsedPaths) int {
225225

226226
output := 1
227227

228-
if !collapsedPaths.IsCollapsed(self.GetPath()) {
228+
if !collapsedPaths.IsCollapsed(self.Path) {
229229
for _, child := range self.Children {
230230
output += child.Size(collapsedPaths)
231231
}

0 commit comments

Comments
 (0)