diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-08-16 08:55:34 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2023-08-29 08:16:40 +0200 |
commit | 4de3fadb00e3829bcda3ae2d4379251c6a81c0a8 (patch) | |
tree | c0fb060d23bad2134083d1e6415196db98562766 | |
parent | 12f24aa8b44aa9e5470099ae0bbc8f2231c912b7 (diff) |
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.
-rw-r--r-- | pkg/gui/context/sub_commits_context.go | 6 | ||||
-rw-r--r-- | pkg/gui/controllers/switch_to_sub_commits_controller.go | 3 |
2 files changed, 2 insertions, 7 deletions
diff --git a/pkg/gui/context/sub_commits_context.go b/pkg/gui/context/sub_commits_context.go index 43cc513c0..b9b3a91b0 100644 --- a/pkg/gui/context/sub_commits_context.go +++ b/pkg/gui/context/sub_commits_context.go @@ -1,14 +1,12 @@ package context import ( - "fmt" "time" "github.com/jesseduffield/lazygit/pkg/commands/git_commands" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/gui/presentation" "github.com/jesseduffield/lazygit/pkg/gui/types" - "github.com/jesseduffield/lazygit/pkg/utils" ) type SubCommitsContext struct { @@ -160,10 +158,6 @@ func (self *SubCommitsContext) GetCommits() []*models.Commit { 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) { self.limitCommits = value } diff --git a/pkg/gui/controllers/switch_to_sub_commits_controller.go b/pkg/gui/controllers/switch_to_sub_commits_controller.go index 5b86854ca..a2b25efbb 100644 --- a/pkg/gui/controllers/switch_to_sub_commits_controller.go +++ b/pkg/gui/controllers/switch_to_sub_commits_controller.go @@ -4,6 +4,7 @@ import ( "github.com/jesseduffield/lazygit/pkg/commands/git_commands" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/gui/types" + "github.com/jesseduffield/lazygit/pkg/utils" ) var _ types.IController = &SwitchToSubCommitsController{} @@ -78,7 +79,7 @@ func (self *SwitchToSubCommitsController) viewCommits() error { subCommitsContext.SetSelectedLineIdx(0) subCommitsContext.SetParentContext(self.context) subCommitsContext.SetWindowName(self.context.GetWindowName()) - subCommitsContext.SetTitleRef(ref.Description()) + subCommitsContext.SetTitleRef(utils.TruncateWithEllipsis(ref.RefName(), 50)) subCommitsContext.SetRef(ref) subCommitsContext.SetLimitCommits(true) subCommitsContext.SetShowBranchHeads(self.context.ShowBranchHeadsInSubCommits()) |