File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import (
1313
1414type BranchCommands struct {
1515 * GitCommon
16- allBranchesLogCmdIndex uint8 // keeps track of current all branches log command
16+ allBranchesLogCmdIndex int // keeps track of current all branches log command
1717}
1818
1919func NewBranchCommands (gitCommon * GitCommon ) * BranchCommands {
@@ -278,14 +278,24 @@ func (self *BranchCommands) allBranchesLogCandidates() []string {
278278func (self * BranchCommands ) AllBranchesLogCmdObj () * oscommands.CmdObj {
279279 candidates := self .allBranchesLogCandidates ()
280280
281+ if self .allBranchesLogCmdIndex >= len (candidates ) {
282+ self .allBranchesLogCmdIndex = 0
283+ }
284+
281285 i := self .allBranchesLogCmdIndex
282286 return self .cmd .New (str .ToArgv (candidates [i ])).DontLog ()
283287}
284288
285289func (self * BranchCommands ) RotateAllBranchesLogIdx () {
286290 n := len (self .allBranchesLogCandidates ())
287291 i := self .allBranchesLogCmdIndex
288- self .allBranchesLogCmdIndex = uint8 ((int (i ) + 1 ) % n )
292+ self .allBranchesLogCmdIndex = (i + 1 ) % n
293+ }
294+
295+ func (self * BranchCommands ) GetAllBranchesLogIdxAndCount () (int , int ) {
296+ n := len (self .allBranchesLogCandidates ())
297+ i := self .allBranchesLogCmdIndex
298+ return i , n
289299}
290300
291301func (self * BranchCommands ) IsBranchMerged (branch * models.Branch , mainBranches * MainBranches ) (bool , error ) {
Original file line number Diff line number Diff 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 })
@@ -196,7 +200,7 @@ func (self *StatusController) switchToOrRotateAllBranchesLogs() {
196200 // A bit of a hack to ensure we only rotate to the next branch log command
197201 // if we currently are looking at a branch log. Otherwise, we should just show
198202 // the current index (if we are coming from the dashboard).
199- if self .c .Views ().Main .Title == self .c .Tr .LogTitle {
203+ if self .c .Views ().Main .Title != self .c .Tr .StatusTitle {
200204 self .c .Git ().Branch .RotateAllBranchesLogIdx ()
201205 }
202206 self .showAllBranchLogs ()
Original file line number Diff line number Diff 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" ,
You can’t perform that action at this time.
0 commit comments