diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2024-06-05 16:55:32 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2024-06-23 11:43:12 +0200 |
commit | 27ad75de161af79c2a87a2a4a647b1cef0ba77e1 (patch) | |
tree | 7b400d184824a6d31cdbc342f056e840d804635e /pkg | |
parent | 3af545daf7cf6458e8efd324012047ce688f08e6 (diff) |
Cleanup: reduce some code duplication
ListContextTrait.OnSearchSelect was introduced in 138be04e65, but it was never
called. I can only guess that a planned refactoring wasn't finished here.
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/gui/context/commit_files_context.go | 5 | ||||
-rw-r--r-- | pkg/gui/context/local_commits_context.go | 5 | ||||
-rw-r--r-- | pkg/gui/context/sub_commits_context.go | 5 | ||||
-rw-r--r-- | pkg/gui/context/working_tree_context.go | 5 |
4 files changed, 4 insertions, 16 deletions
diff --git a/pkg/gui/context/commit_files_context.go b/pkg/gui/context/commit_files_context.go index 7af968fb7..88dac8b45 100644 --- a/pkg/gui/context/commit_files_context.go +++ b/pkg/gui/context/commit_files_context.go @@ -64,10 +64,7 @@ func NewCommitFilesContext(c *ContextCommon) *CommitFilesContext { }, } - ctx.GetView().SetOnSelectItem(ctx.SearchTrait.onSelectItemWrapper(func(selectedLineIdx int) error { - ctx.GetList().SetSelection(selectedLineIdx) - return ctx.HandleFocus(types.OnFocusOpts{}) - })) + ctx.GetView().SetOnSelectItem(ctx.SearchTrait.onSelectItemWrapper(ctx.OnSearchSelect)) return ctx } diff --git a/pkg/gui/context/local_commits_context.go b/pkg/gui/context/local_commits_context.go index d3fc6e240..0458c401b 100644 --- a/pkg/gui/context/local_commits_context.go +++ b/pkg/gui/context/local_commits_context.go @@ -85,10 +85,7 @@ func NewLocalCommitsContext(c *ContextCommon) *LocalCommitsContext { }, } - ctx.GetView().SetOnSelectItem(ctx.SearchTrait.onSelectItemWrapper(func(selectedLineIdx int) error { - ctx.GetList().SetSelection(selectedLineIdx) - return ctx.HandleFocus(types.OnFocusOpts{}) - })) + ctx.GetView().SetOnSelectItem(ctx.SearchTrait.onSelectItemWrapper(ctx.OnSearchSelect)) return ctx } diff --git a/pkg/gui/context/sub_commits_context.go b/pkg/gui/context/sub_commits_context.go index f540dba87..c4f2e318e 100644 --- a/pkg/gui/context/sub_commits_context.go +++ b/pkg/gui/context/sub_commits_context.go @@ -133,10 +133,7 @@ func NewSubCommitsContext( }, } - ctx.GetView().SetOnSelectItem(ctx.SearchTrait.onSelectItemWrapper(func(selectedLineIdx int) error { - ctx.GetList().SetSelection(selectedLineIdx) - return ctx.HandleFocus(types.OnFocusOpts{}) - })) + ctx.GetView().SetOnSelectItem(ctx.SearchTrait.onSelectItemWrapper(ctx.OnSearchSelect)) return ctx } diff --git a/pkg/gui/context/working_tree_context.go b/pkg/gui/context/working_tree_context.go index 6fa462cb1..4f7bfabff 100644 --- a/pkg/gui/context/working_tree_context.go +++ b/pkg/gui/context/working_tree_context.go @@ -51,10 +51,7 @@ func NewWorkingTreeContext(c *ContextCommon) *WorkingTreeContext { }, } - ctx.GetView().SetOnSelectItem(ctx.SearchTrait.onSelectItemWrapper(func(selectedLineIdx int) error { - ctx.GetList().SetSelection(selectedLineIdx) - return ctx.HandleFocus(types.OnFocusOpts{}) - })) + ctx.GetView().SetOnSelectItem(ctx.SearchTrait.onSelectItemWrapper(ctx.OnSearchSelect)) return ctx } |