diff --git a/pkg/gui/context/context.go b/pkg/gui/context/context.go index e3584a8af..a993cf253 100644 --- a/pkg/gui/context/context.go +++ b/pkg/gui/context/context.go @@ -98,8 +98,8 @@ type ContextTree struct { SubCommits *SubCommitsContext Stash *StashContext Suggestions *SuggestionsContext - Normal types.Context - NormalSecondary types.Context + Normal *MainContext + NormalSecondary *MainContext Staging *PatchExplorerContext StagingSecondary *PatchExplorerContext CustomPatchBuilder *PatchExplorerContext diff --git a/pkg/gui/context/main_context.go b/pkg/gui/context/main_context.go new file mode 100644 index 000000000..3749d1d1a --- /dev/null +++ b/pkg/gui/context/main_context.go @@ -0,0 +1,29 @@ +package context + +import ( + "github.com/jesseduffield/gocui" + "github.com/jesseduffield/lazygit/pkg/gui/types" +) + +type MainContext struct { + *SimpleContext +} + +func NewMainContext( + view *gocui.View, + windowName string, + key types.ContextKey, +) *MainContext { + ctx := &MainContext{ + SimpleContext: NewSimpleContext( + NewBaseContext(NewBaseContextOpts{ + Kind: types.MAIN_CONTEXT, + View: view, + WindowName: windowName, + Key: key, + Focusable: false, + })), + } + + return ctx +} diff --git a/pkg/gui/context/setup.go b/pkg/gui/context/setup.go index ec14a5028..33e67fda5 100644 --- a/pkg/gui/context/setup.go +++ b/pkg/gui/context/setup.go @@ -25,38 +25,22 @@ func NewContextTree(c *ContextCommon) *ContextTree { Focusable: true, }), ), - Files: NewWorkingTreeContext(c), - Submodules: NewSubmodulesContext(c), - Menu: NewMenuContext(c), - Remotes: NewRemotesContext(c), - Worktrees: NewWorktreesContext(c), - RemoteBranches: NewRemoteBranchesContext(c), - LocalCommits: NewLocalCommitsContext(c), - CommitFiles: commitFilesContext, - ReflogCommits: NewReflogCommitsContext(c), - SubCommits: NewSubCommitsContext(c), - Branches: NewBranchesContext(c), - Tags: NewTagsContext(c), - Stash: NewStashContext(c), - Suggestions: NewSuggestionsContext(c), - Normal: NewSimpleContext( - NewBaseContext(NewBaseContextOpts{ - Kind: types.MAIN_CONTEXT, - View: c.Views().Main, - WindowName: "main", - Key: NORMAL_MAIN_CONTEXT_KEY, - Focusable: false, - }), - ), - NormalSecondary: NewSimpleContext( - NewBaseContext(NewBaseContextOpts{ - Kind: types.MAIN_CONTEXT, - View: c.Views().Secondary, - WindowName: "secondary", - Key: NORMAL_SECONDARY_CONTEXT_KEY, - Focusable: false, - }), - ), + Files: NewWorkingTreeContext(c), + Submodules: NewSubmodulesContext(c), + Menu: NewMenuContext(c), + Remotes: NewRemotesContext(c), + Worktrees: NewWorktreesContext(c), + RemoteBranches: NewRemoteBranchesContext(c), + LocalCommits: NewLocalCommitsContext(c), + CommitFiles: commitFilesContext, + ReflogCommits: NewReflogCommitsContext(c), + SubCommits: NewSubCommitsContext(c), + Branches: NewBranchesContext(c), + Tags: NewTagsContext(c), + Stash: NewStashContext(c), + Suggestions: NewSuggestionsContext(c), + Normal: NewMainContext(c.Views().Main, "main", NORMAL_MAIN_CONTEXT_KEY), + NormalSecondary: NewMainContext(c.Views().Secondary, "secondary", NORMAL_SECONDARY_CONTEXT_KEY), Staging: NewPatchExplorerContext( c.Views().Staging, "main",