mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
Use Path directly instead of GetPath getter inside the filetree package
This commit is contained in:
parent
53090b2c45
commit
3f4cb8bdda
1 changed files with 6 additions and 6 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue