Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pkg/gui/context/list_context_trait.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ type ListContextTrait struct {
// true if we're inside the OnSearchSelect call; in that case we don't want to update the search
// result index.
inOnSearchSelect bool

// Optional function to append extra info to the footer (e.g. file count in tree view)
footerExtra func() string
}

func (self *ListContextTrait) IsListContext() {}
Expand Down Expand Up @@ -81,7 +84,13 @@ func (self *ListContextTrait) refreshViewport() {
}

func (self *ListContextTrait) setFooter() {
self.GetViewTrait().SetFooter(formatListFooter(self.list.GetSelectedLineIdx(), self.list.Len()))
footer := formatListFooter(self.list.GetSelectedLineIdx(), self.list.Len())
if self.footerExtra != nil {
if extra := self.footerExtra(); extra != "" {
footer += " | " + extra
}
}
self.GetViewTrait().SetFooter(footer)
}

func formatListFooter(selectedLineIdx int, length int) string {
Expand Down
10 changes: 10 additions & 0 deletions pkg/gui/context/working_tree_context.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package context

import (
"fmt"

"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/gui/filetree"
"github.com/jesseduffield/lazygit/pkg/gui/presentation"
Expand Down Expand Up @@ -50,6 +52,14 @@ func NewWorkingTreeContext(c *ContextCommon) *WorkingTreeContext {
getDisplayStrings: getDisplayStrings,
},
c: c,
footerExtra: func() string {
fileCount := len(viewModel.GetAllFiles())
label := "changes"
if fileCount == 1 {
label = "change"
}
return fmt.Sprintf("%d %s", fileCount, label)
},
},
}

Expand Down