1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

Collapse/expand all files in tree

Co-authored-by: Stefan Haller <stefan@haller-berlin.de>
This commit is contained in:
Mauricio Trajano
2024-12-26 23:34:08 -05:00
committed by Stefan Haller
parent 14a91d9829
commit 7bea41534b
21 changed files with 276 additions and 0 deletions

View File

@ -25,6 +25,20 @@ type CommitFileTree struct {
collapsedPaths *CollapsedPaths
}
func (self *CommitFileTree) CollapseAll() {
dirPaths := lo.FilterMap(self.GetAllItems(), func(file *CommitFileNode, index int) (string, bool) {
return file.Path, !file.IsFile()
})
for _, path := range dirPaths {
self.collapsedPaths.Collapse(path)
}
}
func (self *CommitFileTree) ExpandAll() {
self.collapsedPaths.ExpandAll()
}
var _ ICommitFileTree = &CommitFileTree{}
func NewCommitFileTree(getFiles func() []*models.CommitFile, log *logrus.Entry, showTree bool) *CommitFileTree {