1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-06 11:02:41 +03:00

Remove sub_commits_context's Title method

It implemented this because it wants to do custom truncation of the ref name;
however, we can achieve the same thing by passing the truncated ref name to our
DynamicTitleBuilder, which was previously unused.
This commit is contained in:
Stefan Haller
2023-08-16 08:55:34 +02:00
parent 12f24aa8b4
commit 4de3fadb00
2 changed files with 2 additions and 7 deletions

View File

@@ -1,14 +1,12 @@
package context package context
import ( import (
"fmt"
"time" "time"
"github.com/jesseduffield/lazygit/pkg/commands/git_commands" "github.com/jesseduffield/lazygit/pkg/commands/git_commands"
"github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/gui/presentation" "github.com/jesseduffield/lazygit/pkg/gui/presentation"
"github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/utils"
) )
type SubCommitsContext struct { type SubCommitsContext struct {
@@ -160,10 +158,6 @@ func (self *SubCommitsContext) GetCommits() []*models.Commit {
return self.getModel() return self.getModel()
} }
func (self *SubCommitsContext) Title() string {
return fmt.Sprintf(self.c.Tr.SubCommitsDynamicTitle, utils.TruncateWithEllipsis(self.ref.RefName(), 50))
}
func (self *SubCommitsContext) SetLimitCommits(value bool) { func (self *SubCommitsContext) SetLimitCommits(value bool) {
self.limitCommits = value self.limitCommits = value
} }

View File

@@ -4,6 +4,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/commands/git_commands" "github.com/jesseduffield/lazygit/pkg/commands/git_commands"
"github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/utils"
) )
var _ types.IController = &SwitchToSubCommitsController{} var _ types.IController = &SwitchToSubCommitsController{}
@@ -78,7 +79,7 @@ func (self *SwitchToSubCommitsController) viewCommits() error {
subCommitsContext.SetSelectedLineIdx(0) subCommitsContext.SetSelectedLineIdx(0)
subCommitsContext.SetParentContext(self.context) subCommitsContext.SetParentContext(self.context)
subCommitsContext.SetWindowName(self.context.GetWindowName()) subCommitsContext.SetWindowName(self.context.GetWindowName())
subCommitsContext.SetTitleRef(ref.Description()) subCommitsContext.SetTitleRef(utils.TruncateWithEllipsis(ref.RefName(), 50))
subCommitsContext.SetRef(ref) subCommitsContext.SetRef(ref)
subCommitsContext.SetLimitCommits(true) subCommitsContext.SetLimitCommits(true)
subCommitsContext.SetShowBranchHeads(self.context.ShowBranchHeadsInSubCommits()) subCommitsContext.SetShowBranchHeads(self.context.ShowBranchHeadsInSubCommits())