From 026b434c6f52109c8098d11bd4b68eb8eef1f798 Mon Sep 17 00:00:00 2001 From: PeterTimCousins Date: Fri, 3 Apr 2026 14:32:05 +0100 Subject: [PATCH] feat: show actual file count in files panel footer In tree mode, the files panel footer shows "X of Y" where Y includes directory nodes. This can be confusing since it doesn't match the actual number of changed files (as shown by git status). Add a file count suffix to the footer so it reads e.g. "1 of 39 | 23 changes", making the true number of changed files visible at a glance while keeping the tree navigation counter intact. This is implemented via a generic footerExtra callback on ListContextTrait, so other contexts can add footer info in the future without modifying the shared setFooter logic. --- pkg/gui/context/list_context_trait.go | 11 ++++++++++- pkg/gui/context/working_tree_context.go | 10 ++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/pkg/gui/context/list_context_trait.go b/pkg/gui/context/list_context_trait.go index 98833fdb2f7..4999b590524 100644 --- a/pkg/gui/context/list_context_trait.go +++ b/pkg/gui/context/list_context_trait.go @@ -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() {} @@ -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 { diff --git a/pkg/gui/context/working_tree_context.go b/pkg/gui/context/working_tree_context.go index d82037e4457..9007af03100 100644 --- a/pkg/gui/context/working_tree_context.go +++ b/pkg/gui/context/working_tree_context.go @@ -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" @@ -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) + }, }, }