diff --git a/pkg/gui/context/commit_files_context.go b/pkg/gui/context/commit_files_context.go index 97c1728d1..1d936f015 100644 --- a/pkg/gui/context/commit_files_context.go +++ b/pkg/gui/context/commit_files_context.go @@ -78,3 +78,9 @@ func (self *CommitFilesContext) GetDiffTerminals() []string { func (self *CommitFilesContext) ModelSearchResults(searchStr string, caseSensitive bool) []gocui.SearchPosition { return nil } + +func (self *CommitFilesContext) ReInit(ref types.Ref) { + self.SetRef(ref) + self.SetTitleRef(ref.Description()) + self.GetView().Title = self.Title() +} diff --git a/pkg/gui/controllers/helpers/refresh_helper.go b/pkg/gui/controllers/helpers/refresh_helper.go index c1caf4207..40a6b0355 100644 --- a/pkg/gui/controllers/helpers/refresh_helper.go +++ b/pkg/gui/controllers/helpers/refresh_helper.go @@ -285,9 +285,7 @@ func (self *RefreshHelper) refreshCommitsAndCommitFiles() { // For now the awkwardness remains. commit := self.c.Contexts().LocalCommits.GetSelected() if commit != nil && commit.RefName() != "" { - self.c.Contexts().CommitFiles.SetRef(commit) - self.c.Contexts().CommitFiles.SetTitleRef(commit.Description()) - self.c.Contexts().CommitFiles.GetView().Title = self.c.Contexts().CommitFiles.Title() + self.c.Contexts().CommitFiles.ReInit(commit) _ = self.refreshCommitFilesContext() } } diff --git a/pkg/gui/controllers/switch_to_diff_files_controller.go b/pkg/gui/controllers/switch_to_diff_files_controller.go index aa05640b3..1d0cc48f8 100644 --- a/pkg/gui/controllers/switch_to_diff_files_controller.go +++ b/pkg/gui/controllers/switch_to_diff_files_controller.go @@ -71,9 +71,8 @@ func (self *SwitchToDiffFilesController) enter(ref types.Ref) error { } } + commitFilesContext.ReInit(ref) commitFilesContext.SetSelection(0) - commitFilesContext.SetRef(ref) - commitFilesContext.SetTitleRef(ref.Description()) commitFilesContext.SetCanRebase(canRebase) commitFilesContext.SetParentContext(self.context) commitFilesContext.SetWindowName(self.context.GetWindowName())