mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
file tree for commit files
This commit is contained in:
25
pkg/gui/filetree/collapsed_paths.go
Normal file
25
pkg/gui/filetree/collapsed_paths.go
Normal file
@ -0,0 +1,25 @@
|
||||
package filetree
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type CollapsedPaths map[string]bool
|
||||
|
||||
func (cp CollapsedPaths) ExpandToPath(path string) {
|
||||
// need every directory along the way
|
||||
split := strings.Split(path, string(os.PathSeparator))
|
||||
for i := range split {
|
||||
dir := strings.Join(split[0:i+1], string(os.PathSeparator))
|
||||
cp[dir] = false
|
||||
}
|
||||
}
|
||||
|
||||
func (cp CollapsedPaths) IsCollapsed(path string) bool {
|
||||
return cp[path]
|
||||
}
|
||||
|
||||
func (cp CollapsedPaths) ToggleCollapsed(path string) {
|
||||
cp[path] = !cp[path]
|
||||
}
|
Reference in New Issue
Block a user