1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-12 11:15:00 +02:00
lazygit/pkg/gui/filetree/collapsed_paths.go
2021-04-08 21:33:17 +10:00

21 lines
416 B
Go

package filetree
type CollapsedPaths map[string]bool
func (cp CollapsedPaths) ExpandToPath(path string) {
// need every directory along the way
splitPath := split(path)
for i := range splitPath {
dir := join(splitPath[0 : i+1])
cp[dir] = false
}
}
func (cp CollapsedPaths) IsCollapsed(path string) bool {
return cp[path]
}
func (cp CollapsedPaths) ToggleCollapsed(path string) {
cp[path] = !cp[path]
}