From bee6f6cab93b8432d4ca6d4c152c87a2a9754583 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 7 Oct 2025 17:15:19 +0200 Subject: [PATCH] Show "Log (x of y)" in the title bar when there is more than one branch log command --- pkg/commands/git_commands/branch.go | 6 ++++++ pkg/gui/controllers/status_controller.go | 6 +++++- pkg/i18n/english.go | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pkg/commands/git_commands/branch.go b/pkg/commands/git_commands/branch.go index 4a2fbd51f..13abbd697 100644 --- a/pkg/commands/git_commands/branch.go +++ b/pkg/commands/git_commands/branch.go @@ -292,6 +292,12 @@ func (self *BranchCommands) RotateAllBranchesLogIdx() { self.allBranchesLogCmdIndex = (i + 1) % n } +func (self *BranchCommands) GetAllBranchesLogIdxAndCount() (int, int) { + n := len(self.allBranchesLogCandidates()) + i := self.allBranchesLogCmdIndex + return i, n +} + func (self *BranchCommands) IsBranchMerged(branch *models.Branch, mainBranches *MainBranches) (bool, error) { branchesToCheckAgainst := []string{"HEAD"} if branch.RemoteBranchStoredLocally() { diff --git a/pkg/gui/controllers/status_controller.go b/pkg/gui/controllers/status_controller.go index 35545d11a..d2c658095 100644 --- a/pkg/gui/controllers/status_controller.go +++ b/pkg/gui/controllers/status_controller.go @@ -181,10 +181,14 @@ func (self *StatusController) showAllBranchLogs() { cmdObj := self.c.Git().Branch.AllBranchesLogCmdObj() task := types.NewRunPtyTask(cmdObj.GetCmd()) + title := self.c.Tr.LogTitle + if i, n := self.c.Git().Branch.GetAllBranchesLogIdxAndCount(); n > 1 { + title = fmt.Sprintf(self.c.Tr.LogXOfYTitle, i+1, n) + } self.c.RenderToMainViews(types.RefreshMainOpts{ Pair: self.c.MainViewPairs().Normal, Main: &types.ViewUpdateOpts{ - Title: self.c.Tr.LogTitle, + Title: title, Task: task, }, }) diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index d162d20dc..40b707906 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -30,6 +30,7 @@ type TranslationSet struct { RegularMergeTooltip string NormalTitle string LogTitle string + LogXOfYTitle string CommitSummary string CredentialsUsername string CredentialsPassword string @@ -1104,6 +1105,7 @@ func EnglishTranslationSet() *TranslationSet { MergingTitle: "Main panel (merging)", NormalTitle: "Main panel (normal)", LogTitle: "Log", + LogXOfYTitle: "Log (%d of %d)", CommitSummary: "Commit summary", CredentialsUsername: "Username", CredentialsPassword: "Password",