mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-15 11:56:37 +02:00
remove context callback opts
This commit is contained in:
parent
509e3efa70
commit
e2db6a1732
@ -34,7 +34,7 @@ func NewBranchesContext(
|
|||||||
Key: LOCAL_BRANCHES_CONTEXT_KEY,
|
Key: LOCAL_BRANCHES_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
}), ContextCallbackOpts{}),
|
})),
|
||||||
list: viewModel,
|
list: viewModel,
|
||||||
getDisplayStrings: getDisplayStrings,
|
getDisplayStrings: getDisplayStrings,
|
||||||
c: c,
|
c: c,
|
||||||
|
@ -40,7 +40,7 @@ func NewCommitFilesContext(
|
|||||||
Focusable: true,
|
Focusable: true,
|
||||||
Transient: true,
|
Transient: true,
|
||||||
}),
|
}),
|
||||||
ContextCallbackOpts{}),
|
),
|
||||||
list: viewModel,
|
list: viewModel,
|
||||||
getDisplayStrings: getDisplayStrings,
|
getDisplayStrings: getDisplayStrings,
|
||||||
c: c,
|
c: c,
|
||||||
|
@ -29,7 +29,6 @@ func NewCommitMessageContext(
|
|||||||
Focusable: true,
|
Focusable: true,
|
||||||
HasUncontrolledBounds: true,
|
HasUncontrolledBounds: true,
|
||||||
}),
|
}),
|
||||||
ContextCallbackOpts{},
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,6 @@ func NewConfirmationContext(
|
|||||||
Kind: types.TEMPORARY_POPUP,
|
Kind: types.TEMPORARY_POPUP,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
HasUncontrolledBounds: true,
|
HasUncontrolledBounds: true,
|
||||||
}), ContextCallbackOpts{}),
|
})),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ func NewLocalCommitsContext(
|
|||||||
Key: LOCAL_COMMITS_CONTEXT_KEY,
|
Key: LOCAL_COMMITS_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
}), ContextCallbackOpts{}),
|
})),
|
||||||
list: viewModel,
|
list: viewModel,
|
||||||
getDisplayStrings: getDisplayStrings,
|
getDisplayStrings: getDisplayStrings,
|
||||||
c: c,
|
c: c,
|
||||||
|
@ -29,7 +29,7 @@ func NewMenuContext(
|
|||||||
Kind: types.TEMPORARY_POPUP,
|
Kind: types.TEMPORARY_POPUP,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
HasUncontrolledBounds: true,
|
HasUncontrolledBounds: true,
|
||||||
}), ContextCallbackOpts{}),
|
})),
|
||||||
getDisplayStrings: viewModel.GetDisplayStrings,
|
getDisplayStrings: viewModel.GetDisplayStrings,
|
||||||
list: viewModel,
|
list: viewModel,
|
||||||
c: c,
|
c: c,
|
||||||
|
@ -27,8 +27,6 @@ type ConflictsViewModel struct {
|
|||||||
func NewMergeConflictsContext(
|
func NewMergeConflictsContext(
|
||||||
view *gocui.View,
|
view *gocui.View,
|
||||||
|
|
||||||
opts ContextCallbackOpts,
|
|
||||||
|
|
||||||
c *types.HelperCommon,
|
c *types.HelperCommon,
|
||||||
) *MergeConflictsContext {
|
) *MergeConflictsContext {
|
||||||
viewModel := &ConflictsViewModel{
|
viewModel := &ConflictsViewModel{
|
||||||
@ -48,7 +46,6 @@ func NewMergeConflictsContext(
|
|||||||
Focusable: true,
|
Focusable: true,
|
||||||
HighlightOnFocus: true,
|
HighlightOnFocus: true,
|
||||||
}),
|
}),
|
||||||
opts,
|
|
||||||
),
|
),
|
||||||
c: c,
|
c: c,
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ func NewPatchExplorerContext(
|
|||||||
Kind: types.MAIN_CONTEXT,
|
Kind: types.MAIN_CONTEXT,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
HighlightOnFocus: true,
|
HighlightOnFocus: true,
|
||||||
}), ContextCallbackOpts{}),
|
})),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ func NewReflogCommitsContext(
|
|||||||
Key: REFLOG_COMMITS_CONTEXT_KEY,
|
Key: REFLOG_COMMITS_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
}), ContextCallbackOpts{}),
|
})),
|
||||||
list: viewModel,
|
list: viewModel,
|
||||||
getDisplayStrings: getDisplayStrings,
|
getDisplayStrings: getDisplayStrings,
|
||||||
c: c,
|
c: c,
|
||||||
|
@ -37,7 +37,7 @@ func NewRemoteBranchesContext(
|
|||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
Transient: true,
|
Transient: true,
|
||||||
}), ContextCallbackOpts{}),
|
})),
|
||||||
list: viewModel,
|
list: viewModel,
|
||||||
getDisplayStrings: getDisplayStrings,
|
getDisplayStrings: getDisplayStrings,
|
||||||
c: c,
|
c: c,
|
||||||
|
@ -34,7 +34,7 @@ func NewRemotesContext(
|
|||||||
Key: REMOTES_CONTEXT_KEY,
|
Key: REMOTES_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
}), ContextCallbackOpts{}),
|
})),
|
||||||
list: viewModel,
|
list: viewModel,
|
||||||
getDisplayStrings: getDisplayStrings,
|
getDisplayStrings: getDisplayStrings,
|
||||||
c: c,
|
c: c,
|
||||||
|
@ -6,18 +6,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type SimpleContext struct {
|
type SimpleContext struct {
|
||||||
OnRender func() error
|
|
||||||
|
|
||||||
*BaseContext
|
*BaseContext
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContextCallbackOpts struct {
|
func NewSimpleContext(baseContext *BaseContext) *SimpleContext {
|
||||||
OnRender func() error
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewSimpleContext(baseContext *BaseContext, opts ContextCallbackOpts) *SimpleContext {
|
|
||||||
return &SimpleContext{
|
return &SimpleContext{
|
||||||
OnRender: opts.OnRender,
|
|
||||||
BaseContext: baseContext,
|
BaseContext: baseContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -35,7 +28,6 @@ func NewDisplayContext(key types.ContextKey, view *gocui.View, windowName string
|
|||||||
Focusable: false,
|
Focusable: false,
|
||||||
Transient: false,
|
Transient: false,
|
||||||
}),
|
}),
|
||||||
ContextCallbackOpts{},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,9 +59,6 @@ func (self *SimpleContext) HandleFocusLost(opts types.OnFocusLostOpts) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *SimpleContext) HandleRender() error {
|
func (self *SimpleContext) HandleRender() error {
|
||||||
if self.OnRender != nil {
|
|
||||||
return self.OnRender()
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ func NewStashContext(
|
|||||||
Key: STASH_CONTEXT_KEY,
|
Key: STASH_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
}), ContextCallbackOpts{}),
|
})),
|
||||||
list: viewModel,
|
list: viewModel,
|
||||||
getDisplayStrings: getDisplayStrings,
|
getDisplayStrings: getDisplayStrings,
|
||||||
c: c,
|
c: c,
|
||||||
|
@ -45,7 +45,7 @@ func NewSubCommitsContext(
|
|||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
Transient: true,
|
Transient: true,
|
||||||
}), ContextCallbackOpts{}),
|
})),
|
||||||
list: viewModel,
|
list: viewModel,
|
||||||
getDisplayStrings: getDisplayStrings,
|
getDisplayStrings: getDisplayStrings,
|
||||||
c: c,
|
c: c,
|
||||||
|
@ -31,7 +31,7 @@ func NewSubmodulesContext(
|
|||||||
Key: SUBMODULES_CONTEXT_KEY,
|
Key: SUBMODULES_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
}), ContextCallbackOpts{}),
|
})),
|
||||||
list: viewModel,
|
list: viewModel,
|
||||||
getDisplayStrings: getDisplayStrings,
|
getDisplayStrings: getDisplayStrings,
|
||||||
c: c,
|
c: c,
|
||||||
|
@ -53,7 +53,7 @@ func NewSuggestionsContext(
|
|||||||
Kind: types.PERSISTENT_POPUP,
|
Kind: types.PERSISTENT_POPUP,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
HasUncontrolledBounds: true,
|
HasUncontrolledBounds: true,
|
||||||
}), ContextCallbackOpts{}),
|
})),
|
||||||
list: viewModel,
|
list: viewModel,
|
||||||
getDisplayStrings: getDisplayStrings,
|
getDisplayStrings: getDisplayStrings,
|
||||||
c: c,
|
c: c,
|
||||||
|
@ -34,7 +34,7 @@ func NewTagsContext(
|
|||||||
Key: TAGS_CONTEXT_KEY,
|
Key: TAGS_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
}), ContextCallbackOpts{}),
|
})),
|
||||||
list: viewModel,
|
list: viewModel,
|
||||||
getDisplayStrings: getDisplayStrings,
|
getDisplayStrings: getDisplayStrings,
|
||||||
c: c,
|
c: c,
|
||||||
|
@ -32,7 +32,7 @@ func NewWorkingTreeContext(
|
|||||||
Key: FILES_CONTEXT_KEY,
|
Key: FILES_CONTEXT_KEY,
|
||||||
Kind: types.SIDE_CONTEXT,
|
Kind: types.SIDE_CONTEXT,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
}), ContextCallbackOpts{}),
|
})),
|
||||||
list: viewModel,
|
list: viewModel,
|
||||||
getDisplayStrings: getDisplayStrings,
|
getDisplayStrings: getDisplayStrings,
|
||||||
c: c,
|
c: c,
|
||||||
|
@ -17,7 +17,6 @@ func (gui *Gui) contextTree() *context.ContextTree {
|
|||||||
Focusable: false,
|
Focusable: false,
|
||||||
HasUncontrolledBounds: true, // setting to true because the global context doesn't even have a view
|
HasUncontrolledBounds: true, // setting to true because the global context doesn't even have a view
|
||||||
}),
|
}),
|
||||||
context.ContextCallbackOpts{},
|
|
||||||
),
|
),
|
||||||
Status: context.NewSimpleContext(
|
Status: context.NewSimpleContext(
|
||||||
context.NewBaseContext(context.NewBaseContextOpts{
|
context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
@ -27,7 +26,6 @@ func (gui *Gui) contextTree() *context.ContextTree {
|
|||||||
Key: context.STATUS_CONTEXT_KEY,
|
Key: context.STATUS_CONTEXT_KEY,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
}),
|
}),
|
||||||
context.ContextCallbackOpts{},
|
|
||||||
),
|
),
|
||||||
Snake: context.NewSimpleContext(
|
Snake: context.NewSimpleContext(
|
||||||
context.NewBaseContext(context.NewBaseContextOpts{
|
context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
@ -37,7 +35,6 @@ func (gui *Gui) contextTree() *context.ContextTree {
|
|||||||
Key: context.SNAKE_CONTEXT_KEY,
|
Key: context.SNAKE_CONTEXT_KEY,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
}),
|
}),
|
||||||
context.ContextCallbackOpts{},
|
|
||||||
),
|
),
|
||||||
Files: gui.filesListContext(),
|
Files: gui.filesListContext(),
|
||||||
Submodules: gui.submodulesListContext(),
|
Submodules: gui.submodulesListContext(),
|
||||||
@ -60,7 +57,6 @@ func (gui *Gui) contextTree() *context.ContextTree {
|
|||||||
Key: context.NORMAL_MAIN_CONTEXT_KEY,
|
Key: context.NORMAL_MAIN_CONTEXT_KEY,
|
||||||
Focusable: false,
|
Focusable: false,
|
||||||
}),
|
}),
|
||||||
context.ContextCallbackOpts{},
|
|
||||||
),
|
),
|
||||||
NormalSecondary: context.NewSimpleContext(
|
NormalSecondary: context.NewSimpleContext(
|
||||||
context.NewBaseContext(context.NewBaseContextOpts{
|
context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
@ -70,7 +66,6 @@ func (gui *Gui) contextTree() *context.ContextTree {
|
|||||||
Key: context.NORMAL_SECONDARY_CONTEXT_KEY,
|
Key: context.NORMAL_SECONDARY_CONTEXT_KEY,
|
||||||
Focusable: false,
|
Focusable: false,
|
||||||
}),
|
}),
|
||||||
context.ContextCallbackOpts{},
|
|
||||||
),
|
),
|
||||||
Staging: context.NewPatchExplorerContext(
|
Staging: context.NewPatchExplorerContext(
|
||||||
gui.Views.Staging,
|
gui.Views.Staging,
|
||||||
@ -110,11 +105,9 @@ func (gui *Gui) contextTree() *context.ContextTree {
|
|||||||
Key: context.PATCH_BUILDING_SECONDARY_CONTEXT_KEY,
|
Key: context.PATCH_BUILDING_SECONDARY_CONTEXT_KEY,
|
||||||
Focusable: false,
|
Focusable: false,
|
||||||
}),
|
}),
|
||||||
context.ContextCallbackOpts{},
|
|
||||||
),
|
),
|
||||||
MergeConflicts: context.NewMergeConflictsContext(
|
MergeConflicts: context.NewMergeConflictsContext(
|
||||||
gui.Views.MergeConflicts,
|
gui.Views.MergeConflicts,
|
||||||
context.ContextCallbackOpts{},
|
|
||||||
gui.c,
|
gui.c,
|
||||||
),
|
),
|
||||||
Confirmation: context.NewConfirmationContext(gui.c),
|
Confirmation: context.NewConfirmationContext(gui.c),
|
||||||
@ -127,7 +120,6 @@ func (gui *Gui) contextTree() *context.ContextTree {
|
|||||||
Key: context.SEARCH_CONTEXT_KEY,
|
Key: context.SEARCH_CONTEXT_KEY,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
}),
|
}),
|
||||||
context.ContextCallbackOpts{},
|
|
||||||
),
|
),
|
||||||
CommandLog: context.NewSimpleContext(
|
CommandLog: context.NewSimpleContext(
|
||||||
context.NewBaseContext(context.NewBaseContextOpts{
|
context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
@ -137,7 +129,6 @@ func (gui *Gui) contextTree() *context.ContextTree {
|
|||||||
Key: context.COMMAND_LOG_CONTEXT_KEY,
|
Key: context.COMMAND_LOG_CONTEXT_KEY,
|
||||||
Focusable: true,
|
Focusable: true,
|
||||||
}),
|
}),
|
||||||
context.ContextCallbackOpts{},
|
|
||||||
),
|
),
|
||||||
Options: context.NewDisplayContext(context.OPTIONS_CONTEXT_KEY, gui.Views.Options, "options"),
|
Options: context.NewDisplayContext(context.OPTIONS_CONTEXT_KEY, gui.Views.Options, "options"),
|
||||||
AppStatus: context.NewDisplayContext(context.APP_STATUS_CONTEXT_KEY, gui.Views.AppStatus, "appStatus"),
|
AppStatus: context.NewDisplayContext(context.APP_STATUS_CONTEXT_KEY, gui.Views.AppStatus, "appStatus"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user