diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-26 14:44:30 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-26 18:00:46 +1100 |
commit | ad7703df65e09d23bb7e709ca9b22251673ac272 (patch) | |
tree | 67733bcebb87d6504c1d14368cb67a15acc36ecc /pkg/gui | |
parent | 13b90ac37f40baa648c25fab6d299ae0fa59118b (diff) |
show namesake for child views
Diffstat (limited to 'pkg/gui')
22 files changed, 198 insertions, 77 deletions
diff --git a/pkg/gui/commit_files_panel.go b/pkg/gui/commit_files_panel.go index 4f292d3eb..a93486b07 100644 --- a/pkg/gui/commit_files_panel.go +++ b/pkg/gui/commit_files_panel.go @@ -41,6 +41,7 @@ func (gui *Gui) commitFilesRenderToMain() error { func (gui *Gui) SwitchToCommitFilesContext(opts controllers.SwitchToCommitFilesContextOpts) error { gui.State.Contexts.CommitFiles.SetSelectedLineIdx(0) gui.State.Contexts.CommitFiles.SetRefName(opts.RefName) + gui.State.Contexts.CommitFiles.SetTitleRef(opts.RefDescription) gui.State.Contexts.CommitFiles.SetCanRebase(opts.CanRebase) gui.State.Contexts.CommitFiles.SetParentContext(opts.Context) gui.State.Contexts.CommitFiles.SetWindowName(opts.Context.GetWindowName()) @@ -54,7 +55,8 @@ func (gui *Gui) SwitchToCommitFilesContext(opts controllers.SwitchToCommitFilesC func (gui *Gui) refreshCommitFilesContext() error { currentSideContext := gui.currentSideContext() - if currentSideContext.GetKey() == context.COMMIT_FILES_CONTEXT_KEY || currentSideContext.GetKey() == context.LOCAL_COMMITS_CONTEXT_KEY { + if currentSideContext.GetKey() == context.COMMIT_FILES_CONTEXT_KEY || + currentSideContext.GetKey() == context.LOCAL_COMMITS_CONTEXT_KEY { if err := gui.handleRefreshPatchBuildingPanel(-1); err != nil { return err } diff --git a/pkg/gui/context.go b/pkg/gui/context.go index c02411640..c63defba4 100644 --- a/pkg/gui/context.go +++ b/pkg/gui/context.go @@ -151,8 +151,7 @@ func (gui *Gui) deactivateContext(c types.Context) error { if view != nil && (c.GetKind() == types.TEMPORARY_POPUP || c.GetKind() == types.PERSISTENT_POPUP || - c.GetKey() == context.COMMIT_FILES_CONTEXT_KEY || - c.GetKey() == context.SUB_COMMITS_CONTEXT_KEY) { + c.IsTransient()) { view.Visible = false } @@ -393,11 +392,7 @@ func (gui *Gui) onViewFocusLost(oldView *gocui.View, newView *gocui.View) error _ = oldView.SetOriginX(0) if !lo.Contains([]*gocui.View{gui.Views.Main, gui.Views.Secondary, gui.Views.Search}, newView) { - transientContexts := slices.Filter(gui.State.Contexts.Flatten(), func(context types.Context) bool { - return context.IsTransient() - }) - - for _, context := range transientContexts { + for _, context := range gui.TransientContexts() { if oldView.Name() == context.GetViewName() { if err := gui.deactivateContext(context); err != nil { return err @@ -409,6 +404,12 @@ func (gui *Gui) onViewFocusLost(oldView *gocui.View, newView *gocui.View) error return nil } +func (gui *Gui) TransientContexts() []types.Context { + return slices.Filter(gui.State.Contexts.Flatten(), func(context types.Context) bool { + return context.IsTransient() + }) +} + // changeContext is a helper function for when we want to change a 'main' context // which currently just means a context that affects both the main and secondary views // other views can have their context changed directly but this function helps diff --git a/pkg/gui/context/branches_context.go b/pkg/gui/context/branches_context.go index e5de639d9..302f0c1d9 100644 --- a/pkg/gui/context/branches_context.go +++ b/pkg/gui/context/branches_context.go @@ -65,3 +65,13 @@ func (self *BranchesContext) GetSelectedRefName() string { return item.RefName() } + +func (self *BranchesContext) GetSelectedDescription() string { + item := self.GetSelected() + + if item == nil { + return "" + } + + return item.Description() +} diff --git a/pkg/gui/context/commit_files_context.go b/pkg/gui/context/commit_files_context.go index 5ad7144dc..c95486cbf 100644 --- a/pkg/gui/context/commit_files_context.go +++ b/pkg/gui/context/commit_files_context.go @@ -1,18 +1,16 @@ package context import ( - "fmt" - "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/gui/filetree" "github.com/jesseduffield/lazygit/pkg/gui/types" - "github.com/jesseduffield/lazygit/pkg/utils" ) type CommitFilesContext struct { *filetree.CommitFileTreeViewModel *ListContextTrait + *DynamicTitleBuilder } var _ types.IListContext = (*CommitFilesContext)(nil) @@ -32,6 +30,7 @@ func NewCommitFilesContext( return &CommitFilesContext{ CommitFileTreeViewModel: viewModel, + DynamicTitleBuilder: NewDynamicTitleBuilder(c.Tr.CommitFilesDynamicTitle), ListContextTrait: &ListContextTrait{ Context: NewSimpleContext( NewBaseContext(NewBaseContextOpts{ @@ -63,7 +62,3 @@ func (self *CommitFilesContext) GetSelectedItemId() string { return item.ID() } - -func (self *CommitFilesContext) Title() string { - return fmt.Sprintf(self.c.Tr.CommitFilesDynamicTitle, utils.TruncateWithEllipsis(self.GetRefName(), 50)) -} diff --git a/pkg/gui/context/context.go b/pkg/gui/context/context.go index add336cfd..fb5a4bd64 100644 --- a/pkg/gui/context/context.go +++ b/pkg/gui/context/context.go @@ -152,11 +152,8 @@ func (tree ContextTree) InitialViewTabContextMap() map[string][]TabContext { Contexts: []types.Context{tree.Branches}, }, { - Tab: "Remotes", - Contexts: []types.Context{ - tree.Remotes, - tree.RemoteBranches, - }, + Tab: "Remotes", + Contexts: []types.Context{tree.Remotes}, }, { Tab: "Tags", @@ -169,10 +166,8 @@ func (tree ContextTree) InitialViewTabContextMap() map[string][]TabContext { Contexts: []types.Context{tree.LocalCommits}, }, { - Tab: "Reflog", - Contexts: []types.Context{ - tree.ReflogCommits, - }, + Tab: "Reflog", + Contexts: []types.Context{tree.ReflogCommits}, }, }, "files": { @@ -181,10 +176,8 @@ func (tree ContextTree) InitialViewTabContextMap() map[string][]TabContext { Contexts: []types.Context{tree.Files}, }, { - Tab: "Submodules", - Contexts: []types.Context{ - tree.Submodules, - }, + Tab: "Submodules", + Contexts: []types.Context{tree.Submodules}, }, }, } diff --git a/pkg/gui/context/dynamic_title_builder.go b/pkg/gui/context/dynamic_title_builder.go new file mode 100644 index 000000000..ee4facad2 --- /dev/null +++ b/pkg/gui/context/dynamic_title_builder.go @@ -0,0 +1,23 @@ +package context + +import "fmt" + +type DynamicTitleBuilder struct { + formatStr string // e.g. 'remote branches for %s' + + titleRef string // e.g. 'origin' +} + +func NewDynamicTitleBuilder(formatStr string) *DynamicTitleBuilder { + return &DynamicTitleBuilder{ + formatStr: formatStr, + } +} + +func (self *DynamicTitleBuilder) SetTitleRef(titleRef string) { + self.titleRef = titleRef +} + +func (self *DynamicTitleBuilder) Title() string { + return fmt.Sprintf(self.formatStr, self.titleRef) +} diff --git a/pkg/gui/context/local_commits_context.go b/pkg/gui/context/local_commits_context.go index cc7a2a0d2..0d7cc2f54 100644 --- a/pkg/gui/context/local_commits_context.go +++ b/pkg/gui/context/local_commits_context.go @@ -93,6 +93,16 @@ func (self *LocalCommitsContext) GetSelectedRefName() string { return item.RefName() } +func (self *LocalCommitsViewModel) GetSelectedDescription() string { + item := self.GetSelected() + + if item == nil { + return "" + } + + return item.Description() +} + func (self *LocalCommitsViewModel) SetLimitCommits(value bool) { self.limitCommits = value } diff --git a/pkg/gui/context/reflog_commits_context.go b/pkg/gui/context/reflog_commits_context.go index a1ad6cfda..0274a921e 100644 --- a/pkg/gui/context/reflog_commits_context.go +++ b/pkg/gui/context/reflog_commits_context.go @@ -74,3 +74,13 @@ func (self *ReflogCommitsContext) GetSelectedRefName() string { func (self *ReflogCommitsContext) GetCommits() []*models.Commit { return self.getModel() } + +func (self *ReflogCommitsContext) GetSelectedDescription() string { + item := self.GetSelected() + + if item == nil { + return "" + } + + return item.Description() +} diff --git a/pkg/gui/context/remote_branches_context.go b/pkg/gui/context/remote_branches_context.go index 3cdd43a69..52217ef11 100644 --- a/pkg/gui/context/remote_branches_context.go +++ b/pkg/gui/context/remote_branches_context.go @@ -9,6 +9,7 @@ import ( type RemoteBranchesContext struct { *BasicViewModel[*models.RemoteBranch] *ListContextTrait + *DynamicTitleBuilder } var _ types.IListContext = (*RemoteBranchesContext)(nil) @@ -27,14 +28,16 @@ func NewRemoteBranchesContext( viewModel := NewBasicViewModel(getModel) return &RemoteBranchesContext{ - BasicViewModel: viewModel, + BasicViewModel: viewModel, + DynamicTitleBuilder: NewDynamicTitleBuilder(c.Tr.RemoteBranchesDynamicTitle), ListContextTrait: &ListContextTrait{ Context: NewSimpleContext(NewBaseContext(NewBaseContextOpts{ - ViewName: "branches", + ViewName: "remoteBranches", WindowName: "branches", Key: REMOTE_BRANCHES_CONTEXT_KEY, Kind: types.SIDE_CONTEXT, Focusable: true, + Transient: true, }), ContextCallbackOpts{ OnFocus: onFocus, OnFocusLost: onFocusLost, @@ -65,3 +68,13 @@ func (self *RemoteBranchesContext) GetSelectedRefName() string { return item.RefName() } + +func (self *RemoteBranchesContext) GetSelectedDescription() string { + item := self.GetSelected() + + if item == nil { + return "" + } + + return item.Description() +} diff --git a/pkg/gui/context/stash_context.go b/pkg/gui/context/stash_context.go index e2af64d10..ef443846f 100644 --- a/pkg/gui/context/stash_context.go +++ b/pkg/gui/context/stash_context.go @@ -70,3 +70,13 @@ func (self *StashContext) GetSelectedRefName() string { return item.RefName() } + +func (self *StashContext) GetSelectedDescription() string { + item := self.GetSelected() + + if item == nil { + return "" + } + + return item.Description() +} diff --git a/pkg/gui/context/sub_commits_context.go b/pkg/gui/context/sub_commits_context.go index 6c1d5910f..ffc053267 100644 --- a/pkg/gui/context/sub_commits_context.go +++ b/pkg/gui/context/sub_commits_context.go @@ -12,6 +12,7 @@ import ( type SubCommitsContext struct { *SubCommitsViewModel *ViewportListContextTrait + *DynamicTitleBuilder } var _ types.IListContext = (*SubCommitsContext)(nil) @@ -34,6 +35,7 @@ func NewSubCommitsContext( return &SubCommitsContext{ SubCommitsViewModel: viewModel, + DynamicTitleBuilder: NewDynamicTitleBuilder(c.Tr.SubCommitsDynamicTitle), ViewportListContextTrait: &ViewportListContextTrait{ ListContextTrait: &ListContextTrait{ Context: NewSimpleContext(NewBaseContext(NewBaseContextOpts{ @@ -99,3 +101,13 @@ func (self *SubCommitsContext) GetCommits() []*models.Commit { func (self *SubCommitsContext) Title() string { return fmt.Sprintf(self.c.Tr.SubCommitsDynamicTitle, utils.TruncateWithEllipsis(self.refName, 50)) } + +func (self *SubCommitsContext) GetSelectedDescription() string { + item := self.GetSelected() + + if item == nil { + return "" + } + + return item.Description() +} diff --git a/pkg/gui/context/tags_context.go b/pkg/gui/context/tags_context.go index fd411ec9a..d6f8d78ac 100644 --- a/pkg/gui/context/tags_context.go +++ b/pkg/gui/context/tags_context.go @@ -65,3 +65,13 @@ func (self *TagsContext) GetSelectedRefName() string { return item.RefName() } + +func (self *TagsContext) GetSelectedDescription() string { + item := self.GetSelected() + + if item == nil { + return "" + } + + return item.Description() +} diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index 41433068d..1df223365 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -497,9 +497,7 @@ func (self *LocalCommitsController) createFixupCommit(commit *models.Commit) err func (self *LocalCommitsController) squashAllAboveFixupCommits(commit *models.Commit) error { prompt := utils.ResolvePlaceholderString( self.c.Tr.SureSquashAboveCommits, - map[string]string{ - "commit": commit.Sha, - }, + map[string]string{"commit": commit.Sha}, ) return self.c.Ask(types.AskOpts{ @@ -561,7 +559,9 @@ func (self *LocalCommitsController) handleOpenLogMenu() error { } return self.c.WithWaitingStatus(self.c.Tr.LcLoadingCommits, func() error { - return self.c.Refresh(types.RefreshOptions{Mode: types.SYNC, Scope: []types.RefreshableView{types.COMMITS}}) + return self.c.Refresh( + types.RefreshOptions{Mode: types.SYNC, Scope: []types.RefreshableView{types.COMMITS}}, + ) }) }, }, @@ -602,7 +602,12 @@ func (self *LocalCommitsController) handleOpenLogMenu() error { return func() error { self.c.UserConfig.Git.Log.Order = value return self.c.WithWaitingStatus(self.c.Tr.LcLoadingCommits, func() error { - return self.c.Refresh(types.RefreshOptions{Mode: types.SYNC, Scope: []types.RefreshableView{types.COMMITS}}) + return self.c.Refresh( + types.RefreshOptions{ + Mode: types.SYNC, + Scope: []types.RefreshableView{types.COMMITS}, + }, + ) }) } } diff --git a/pkg/gui/controllers/remotes_controller.go b/pkg/gui/controllers/remotes_controller.go index fd4b34297..208f36af7 100644 --- a/pkg/gui/controllers/remotes_controller.go +++ b/pkg/gui/controllers/remotes_controller.go @@ -73,6 +73,11 @@ func (self *RemotesController) enter(remote *models.Remote) error { newSelectedLine = -1 } self.contexts.RemoteBranches.SetSelectedLineIdx(newSelectedLine) + self.contexts.RemoteBranches.SetTitleRef(remote.Name) + + if err := self.c.PostRefreshUpdate(self.contexts.RemoteBranches); err != nil { + return err + } return self.c.PushContext(self.contexts.RemoteBranches) } diff --git a/pkg/gui/controllers/switch_to_diff_files_controller.go b/pkg/gui/controllers/switch_to_diff_files_controller.go index 9a3111cae..c41dbdd37 100644 --- a/pkg/gui/controllers/switch_to_diff_files_controller.go +++ b/pkg/gui/controllers/switch_to_diff_files_controller.go @@ -12,6 +12,7 @@ type CanSwitchToDiffFiles interface { types.Context CanRebase() bool GetSelectedRefName() string + GetSelectedDescription() string } type SwitchToDiffFilesController struct { @@ -63,9 +64,10 @@ func (self *SwitchToDiffFilesController) checkSelected(callback func(string) err func (self *SwitchToDiffFilesController) enter(refName string) error { return self.viewFiles(SwitchToCommitFilesContextOpts{ - RefName: refName, - CanRebase: self.context.CanRebase(), - Context: self.context, + RefName: refName, + RefDescription: self.context.GetSelectedDescription(), + CanRebase: self.context.CanRebase(), + Context: self.context, }) } diff --git a/pkg/gui/controllers/switch_to_sub_commits_controller.go b/pkg/gui/controllers/switch_to_sub_commits_controller.go index 82b52509b..d59f4fdbf 100644 --- a/pkg/gui/controllers/switch_to_sub_commits_controller.go +++ b/pkg/gui/controllers/switch_to_sub_commits_controller.go @@ -11,6 +11,7 @@ var _ types.IController = &SwitchToSubCommitsController{} type CanSwitchToSubCommits interface { types.Context GetSelectedRefName() string + GetSelectedDescription() string } type SwitchToSubCommitsController struct { @@ -74,6 +75,7 @@ func (self *SwitchToSubCommitsController) viewCommits() error { self.contexts.SubCommits.SetSelectedLineIdx(0) self.contexts.SubCommits.SetParentContext(self.context) self.contexts.SubCommits.SetWindowName(self.context.GetWindowName()) + self.contexts.SubCommits.SetTitleRef(self.context.GetSelectedDescription()) self.contexts.SubCommits.SetRefName(refName) err = self.c.PostRefreshUpdate(self.contexts.SubCommits) diff --git a/pkg/gui/controllers/types.go b/pkg/gui/controllers/types.go index 9783ca3b7..e9af41089 100644 --- a/pkg/gui/controllers/types.go +++ b/pkg/gui/controllers/types.go @@ -6,7 +6,17 @@ import ( // all fields mandatory (except `CanRebase` because it's boolean) type SwitchToCommitFilesContextOpts struct { - RefName string + // this is something like a commit sha or branch name + RefName string + + // this will be displayed in the title of the view so we know whose diff files + // we're viewing + RefDescription string + + // from the local commits view we're allowed to do rebase stuff with any patch + // we generate from the diff files context, but we don't have that same ability + // with say the sub commits context or the reflog context. CanRebase bool - Context types.Context + + Context types.Context } diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 334133487..b4e0f8de4 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -240,26 +240,27 @@ type panelStates struct { } type Views struct { - Status *gocui.View - Files *gocui.View - Branches *gocui.View - Commits *gocui.View - Stash *gocui.View - Main *gocui.View - Secondary *gocui.View - Options *gocui.View - Confirmation *gocui.View - Menu *gocui.View - CommitMessage *gocui.View - CommitFiles *gocui.View - SubCommits *gocui.View - Information *gocui.View - AppStatus *gocui.View - Search *gocui.View - SearchPrefix *gocui.View - Limit *gocui.View - Suggestions *gocui.View - Extras *gocui.View + Status *gocui.View + Files *gocui.View + Branches *gocui.View + RemoteBranches *gocui.View + Commits *gocui.View + Stash *gocui.View + Main *gocui.View + Secondary *gocui.View + Options *gocui.View + Confirmation *gocui.View + Menu *gocui.View + CommitMessage *gocui.View + CommitFiles *gocui.View + SubCommits *gocui.View + Information *gocui.View + AppStatus *gocui.View + Search *gocui.View + SearchPrefix *gocui.View + Limit *gocui.View + Suggestions *gocui.View + Extras *gocui.View } type searchingState struct { @@ -406,19 +407,20 @@ func (gui *Gui) syncViewContexts() { func initialViewContextMapping(contextTree *context.ContextTree) map[string]types.Context { return map[string]types.Context{ - "status": contextTree.Status, - "files": contextTree.Files, - "branches": contextTree.Branches, - "commits": contextTree.LocalCommits, - "commitFiles": contextTree.CommitFiles, - "subCommits": contextTree.SubCommits, - "stash": contextTree.Stash, - "menu": contextTree.Menu, - "confirmation": contextTree.Confirmation, - "commitMessage": contextTree.CommitMessage, - "main": contextTree.Normal, - "secondary": contextTree.Normal, - "extras": contextTree.CommandLog, + "status": contextTree.Status, + "files": contextTree.Files, + "branches": contextTree.Branches, + "remoteBranches": contextTree.RemoteBranches, + "commits": contextTree.LocalCommits, + "commitFiles": contextTree.CommitFiles, + "subCommits": contextTree.SubCommits, + "stash": contextTree.Stash, + "menu": contextTree.Menu, + "confirmation": contextTree.Confirmation, + "commitMessage": contextTree.CommitMessage, + "main": contextTree.Normal, + "secondary": contextTree.Normal, + "extras": contextTree.CommandLog, } } @@ -600,6 +602,7 @@ func (gui *Gui) createAllViews() error { {viewPtr: &gui.Views.Status, name: "status"}, {viewPtr: &gui.Views.Files, name: "files"}, {viewPtr: &gui.Views.Branches, name: "branches"}, + {viewPtr: &gui.Views.RemoteBranches, name: "remoteBranches"}, {viewPtr: &gui.Views.Commits, name: "commits"}, {viewPtr: &gui.Views.Stash, name: "stash"}, {viewPtr: &gui.Views.CommitFiles, name: "commitFiles"}, @@ -649,6 +652,8 @@ func (gui *Gui) createAllViews() error { gui.Views.Branches.Title = gui.c.Tr.BranchesTitle gui.Views.Branches.FgColor = theme.GocuiDefaultTextColor + gui.Views.RemoteBranches.FgColor = theme.GocuiDefaultTextColor + gui.Views.Files.Highlight = true gui.Views.Files.Title = gui.c.Tr.FilesTitle gui.Views.Files.FgColor = theme.GocuiDefaultTextColor diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 122fbfd04..e19f42935 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -999,7 +999,7 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi mouseKeybindings = append(mouseKeybindings, c.GetMouseKeybindings(opts)...) } - for _, viewName := range []string{"status", "branches", "files", "commits", "commitFiles", "subCommits", "stash", "menu"} { + for _, viewName := range []string{"status", "branches", "remoteBranches", "files", "commits", "commitFiles", "subCommits", "stash", "menu"} { bindings = append(bindings, []*types.Binding{ {ViewName: viewName, Key: opts.GetKey(opts.Config.Universal.PrevBlock), Modifier: gocui.ModNone, Handler: self.previousSideWindow}, {ViewName: viewName, Key: opts.GetKey(opts.Config.Universal.NextBlock), Modifier: gocui.ModNone, Handler: self.nextSideWindow}, diff --git a/pkg/gui/layout.go b/pkg/gui/layout.go index c77c9030d..2fb165ff4 100644 --- a/pkg/gui/layout.go +++ b/pkg/gui/layout.go @@ -2,7 +2,6 @@ package gui import ( "github.com/jesseduffield/gocui" - "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/jesseduffield/lazygit/pkg/theme" ) @@ -96,6 +95,7 @@ func (gui *Gui) layout(g *gocui.Gui) error { {viewName: "status", windowName: "status", frame: true}, {viewName: "files", windowName: "files", frame: true}, {viewName: "branches", windowName: "branches", frame: true}, + {viewName: "remoteBranches", windowName: "branches", frame: true}, {viewName: "commitFiles", windowName: gui.State.Contexts.CommitFiles.GetWindowName(), frame: true}, {viewName: "subCommits", windowName: gui.State.Contexts.SubCommits.GetWindowName(), frame: true}, {viewName: "commits", windowName: "commits", frame: true}, @@ -115,7 +115,7 @@ func (gui *Gui) layout(g *gocui.Gui) error { } } - for _, context := range []types.Context{gui.State.Contexts.SubCommits, gui.State.Contexts.CommitFiles} { + for _, context := range gui.TransientContexts() { view, err := gui.g.View(context.GetViewName()) if err != nil && err.Error() != UNKNOWN_VIEW_ERROR_MSG { return err @@ -211,6 +211,7 @@ func (gui *Gui) onInitialViewsCreation() error { gui.Views.Status, gui.Views.Files, gui.Views.Branches, + gui.Views.RemoteBranches, gui.Views.Commits, gui.Views.Stash, gui.Views.SubCommits, diff --git a/pkg/gui/list_context_config.go b/pkg/gui/list_context_config.go index b2f267a6a..e8a65d6da 100644 --- a/pkg/gui/list_context_config.go +++ b/pkg/gui/list_context_config.go @@ -71,7 +71,7 @@ func (gui *Gui) remotesListContext() *context.RemotesContext { func (gui *Gui) remoteBranchesListContext() *context.RemoteBranchesContext { return context.NewRemoteBranchesContext( func() []*models.RemoteBranch { return gui.State.Model.RemoteBranches }, - gui.Views.Branches, + gui.Views.RemoteBranches, func(startIdx int, length int) [][]string { return presentation.GetRemoteBranchListDisplayStrings(gui.State.Model.RemoteBranches, gui.State.Modes.Diffing.Ref) }, diff --git a/pkg/gui/refresh.go b/pkg/gui/refresh.go index f56cb55d7..244c0c050 100644 --- a/pkg/gui/refresh.go +++ b/pkg/gui/refresh.go @@ -187,6 +187,7 @@ func (gui *Gui) refreshCommits() { commit := gui.getSelectedLocalCommit() if commit != nil { gui.State.Contexts.CommitFiles.SetRefName(commit.RefName()) + gui.State.Contexts.CommitFiles.SetTitleRef(commit.RefName()) _ = gui.refreshCommitFilesContext() } } @@ -490,6 +491,7 @@ func (gui *Gui) refreshRemotes() error { for _, remote := range remotes { if remote.Name == prevSelectedRemote.Name { gui.State.Model.RemoteBranches = remote.Branches + break } } } |