diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-08-06 18:50:52 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-08-07 11:16:03 +1000 |
commit | 7410acd1aaa97f678295a328264360802346b33a (patch) | |
tree | 51dc6b5dfc8c0b67711ff644a6bc32480e6eaea8 /pkg/gui/context_config.go | |
parent | 445a625b56a79be6cee7ec1ee35fe9f4fcc2daad (diff) |
move merge conflicts code into controller
Diffstat (limited to 'pkg/gui/context_config.go')
-rw-r--r-- | pkg/gui/context_config.go | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/pkg/gui/context_config.go b/pkg/gui/context_config.go index 79f14c68c..7bd0ca7f8 100644 --- a/pkg/gui/context_config.go +++ b/pkg/gui/context_config.go @@ -164,16 +164,21 @@ func (gui *Gui) contextTree() *context.ContextTree { OnFocus: OnFocusWrapper(func() error { gui.Views.MergeConflicts.Wrap = false - return gui.renderConflictsWithLock(true) + return gui.refreshMergePanel(true) }), - OnFocusLost: func(types.OnFocusLostOpts) error { + OnFocusLost: func(opts types.OnFocusLostOpts) error { + gui.State.Contexts.MergeConflicts.SetUserScrolling(false) + gui.State.Contexts.MergeConflicts.GetState().ResetConflictSelection() gui.Views.MergeConflicts.Wrap = true return nil }, }, gui.c, - gui.getMergingOptions, + func() map[string]string { + // wrapping in a function because contexts are initialized before helpers + return gui.helpers.MergeConflicts.GetMergingOptions() + }, ), Confirmation: context.NewSimpleContext( context.NewBaseContext(context.NewBaseContextOpts{ @@ -217,12 +222,11 @@ func (gui *Gui) contextTree() *context.ContextTree { ), CommandLog: context.NewSimpleContext( context.NewBaseContext(context.NewBaseContextOpts{ - Kind: types.EXTRAS_CONTEXT, - View: gui.Views.Extras, - WindowName: "extras", - Key: context.COMMAND_LOG_CONTEXT_KEY, - OnGetOptionsMap: gui.getMergingOptions, - Focusable: true, + Kind: types.EXTRAS_CONTEXT, + View: gui.Views.Extras, + WindowName: "extras", + Key: context.COMMAND_LOG_CONTEXT_KEY, + Focusable: true, }), context.ContextCallbackOpts{ OnFocusLost: func(opts types.OnFocusLostOpts) error { |