1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

make more use of generics

This commit is contained in:
Jesse Duffield
2022-03-19 12:26:30 +11:00
parent dde30fa104
commit c7a629c440
52 changed files with 3013 additions and 274 deletions

View File

@ -87,7 +87,7 @@ func (s *FileNode) Any(test func(node *FileNode) bool) bool {
})
}
func (n *FileNode) Flatten(collapsedPaths map[string]bool) []*FileNode {
func (n *FileNode) Flatten(collapsedPaths *CollapsedPaths) []*FileNode {
results := flatten(n, collapsedPaths)
nodes := make([]*FileNode, len(results))
for i, result := range results {
@ -97,7 +97,7 @@ func (n *FileNode) Flatten(collapsedPaths map[string]bool) []*FileNode {
return nodes
}
func (node *FileNode) GetNodeAtIndex(index int, collapsedPaths map[string]bool) *FileNode {
func (node *FileNode) GetNodeAtIndex(index int, collapsedPaths *CollapsedPaths) *FileNode {
if node == nil {
return nil
}
@ -111,11 +111,11 @@ func (node *FileNode) GetNodeAtIndex(index int, collapsedPaths map[string]bool)
return result.(*FileNode)
}
func (node *FileNode) GetIndexForPath(path string, collapsedPaths map[string]bool) (int, bool) {
func (node *FileNode) GetIndexForPath(path string, collapsedPaths *CollapsedPaths) (int, bool) {
return getIndexForPath(node, path, collapsedPaths)
}
func (node *FileNode) Size(collapsedPaths map[string]bool) int {
func (node *FileNode) Size(collapsedPaths *CollapsedPaths) int {
if node == nil {
return 0
}