Skip to content

Commit 5d02cba

Browse files
committed
Show "Log (x of y)" in the title bar when there is more than one branch log command
1 parent bf56a61 commit 5d02cba

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

pkg/commands/git_commands/branch.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,12 @@ func (self *BranchCommands) RotateAllBranchesLogIdx() {
292292
self.allBranchesLogCmdIndex = (i + 1) % n
293293
}
294294

295+
func (self *BranchCommands) GetAllBranchesLogIdxAndCount() (int, int) {
296+
n := len(self.allBranchesLogCandidates())
297+
i := self.allBranchesLogCmdIndex
298+
return i, n
299+
}
300+
295301
func (self *BranchCommands) IsBranchMerged(branch *models.Branch, mainBranches *MainBranches) (bool, error) {
296302
branchesToCheckAgainst := []string{"HEAD"}
297303
if branch.RemoteBranchStoredLocally() {

pkg/gui/controllers/status_controller.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,14 @@ func (self *StatusController) showAllBranchLogs() {
181181
cmdObj := self.c.Git().Branch.AllBranchesLogCmdObj()
182182
task := types.NewRunPtyTask(cmdObj.GetCmd())
183183

184+
title := self.c.Tr.LogTitle
185+
if i, n := self.c.Git().Branch.GetAllBranchesLogIdxAndCount(); n > 1 {
186+
title = fmt.Sprintf(self.c.Tr.LogXOfYTitle, i+1, n)
187+
}
184188
self.c.RenderToMainViews(types.RefreshMainOpts{
185189
Pair: self.c.MainViewPairs().Normal,
186190
Main: &types.ViewUpdateOpts{
187-
Title: self.c.Tr.LogTitle,
191+
Title: title,
188192
Task: task,
189193
},
190194
})

pkg/i18n/english.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type TranslationSet struct {
3030
RegularMergeTooltip string
3131
NormalTitle string
3232
LogTitle string
33+
LogXOfYTitle string
3334
CommitSummary string
3435
CredentialsUsername string
3536
CredentialsPassword string
@@ -1110,6 +1111,7 @@ func EnglishTranslationSet() *TranslationSet {
11101111
MergingTitle: "Main panel (merging)",
11111112
NormalTitle: "Main panel (normal)",
11121113
LogTitle: "Log",
1114+
LogXOfYTitle: "Log (%d of %d)",
11131115
CommitSummary: "Commit summary",
11141116
CredentialsUsername: "Username",
11151117
CredentialsPassword: "Password",

0 commit comments

Comments
 (0)