Skip to content

Commit bee6f6c

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

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
@@ -1104,6 +1105,7 @@ func EnglishTranslationSet() *TranslationSet {
11041105
MergingTitle: "Main panel (merging)",
11051106
NormalTitle: "Main panel (normal)",
11061107
LogTitle: "Log",
1108+
LogXOfYTitle: "Log (%d of %d)",
11071109
CommitSummary: "Commit summary",
11081110
CredentialsUsername: "Username",
11091111
CredentialsPassword: "Password",

0 commit comments

Comments
 (0)