From 8302575078d71ab318f6c02815778259a8c9d9df Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Wed, 4 Sep 2024 14:26:15 +0200 Subject: [PATCH] Remove return value of Focus-related functions --- pkg/gui/context.go | 8 ++------ pkg/gui/context/base_context.go | 4 ++-- pkg/gui/context/list_context_trait.go | 11 ++++++----- pkg/gui/context/patch_explorer_context.go | 4 +--- pkg/gui/context/simple_context.go | 13 ++++--------- pkg/gui/controllers/base_controller.go | 4 ++-- pkg/gui/controllers/bisect_controller.go | 2 +- pkg/gui/controllers/command_log_controller.go | 5 ++--- pkg/gui/controllers/commit_message_controller.go | 5 ++--- pkg/gui/controllers/confirmation_controller.go | 5 ++--- pkg/gui/controllers/files_controller.go | 6 ++++-- pkg/gui/controllers/helpers/confirmation_helper.go | 2 +- pkg/gui/controllers/list_controller.go | 11 +++++++---- pkg/gui/controllers/local_commits_controller.go | 6 ++---- pkg/gui/controllers/menu_controller.go | 5 ++--- pkg/gui/controllers/merge_conflicts_controller.go | 12 ++++-------- pkg/gui/controllers/patch_building_controller.go | 14 +++++++------- pkg/gui/controllers/snake_controller.go | 10 ++++------ pkg/gui/controllers/staging_controller.go | 10 ++++------ pkg/gui/controllers/sub_commits_controller.go | 6 ++---- pkg/gui/controllers/suggestions_controller.go | 5 ++--- pkg/gui/controllers/toggle_whitespace_action.go | 3 ++- pkg/gui/types/context.go | 14 +++++++------- pkg/gui/view_helpers.go | 4 +--- 24 files changed, 73 insertions(+), 96 deletions(-) diff --git a/pkg/gui/context.go b/pkg/gui/context.go index 3ac1425fb..66d0e5f25 100644 --- a/pkg/gui/context.go +++ b/pkg/gui/context.go @@ -183,9 +183,7 @@ func (self *ContextMgr) deactivate(c types.Context, opts types.OnFocusLostOpts) view.Visible = false } - if err := c.HandleFocusLost(opts); err != nil { - return err - } + c.HandleFocusLost(opts) return nil } @@ -219,9 +217,7 @@ func (self *ContextMgr) Activate(c types.Context, opts types.OnFocusOpts) error self.gui.c.GocuiGui().Cursor = v.Editable - if err := c.HandleFocus(opts); err != nil { - return err - } + c.HandleFocus(opts) return nil } diff --git a/pkg/gui/context/base_context.go b/pkg/gui/context/base_context.go index 2bcf0e25e..76482ad0f 100644 --- a/pkg/gui/context/base_context.go +++ b/pkg/gui/context/base_context.go @@ -31,8 +31,8 @@ type BaseContext struct { } type ( - onFocusFn = func(types.OnFocusOpts) error - onFocusLostFn = func(types.OnFocusLostOpts) error + onFocusFn = func(types.OnFocusOpts) + onFocusLostFn = func(types.OnFocusLostOpts) ) var _ types.IBaseContext = &BaseContext{} diff --git a/pkg/gui/context/list_context_trait.go b/pkg/gui/context/list_context_trait.go index db95cf2b7..874e4648f 100644 --- a/pkg/gui/context/list_context_trait.go +++ b/pkg/gui/context/list_context_trait.go @@ -72,22 +72,22 @@ func formatListFooter(selectedLineIdx int, length int) string { return fmt.Sprintf("%d of %d", selectedLineIdx+1, length) } -func (self *ListContextTrait) HandleFocus(opts types.OnFocusOpts) error { +func (self *ListContextTrait) HandleFocus(opts types.OnFocusOpts) { self.FocusLine() self.GetViewTrait().SetHighlight(self.list.Len() > 0) - return self.Context.HandleFocus(opts) + self.Context.HandleFocus(opts) } -func (self *ListContextTrait) HandleFocusLost(opts types.OnFocusLostOpts) error { +func (self *ListContextTrait) HandleFocusLost(opts types.OnFocusLostOpts) { self.GetViewTrait().SetOriginX(0) if self.refreshViewportOnChange { self.refreshViewport() } - return self.Context.HandleFocusLost(opts) + self.Context.HandleFocusLost(opts) } // OnFocus assumes that the content of the context has already been rendered to the view. OnRender is the function which actually renders the content to the view @@ -114,7 +114,8 @@ func (self *ListContextTrait) HandleRender() { func (self *ListContextTrait) OnSearchSelect(selectedLineIdx int) error { self.GetList().SetSelection(self.ViewIndexToModelIndex(selectedLineIdx)) - return self.HandleFocus(types.OnFocusOpts{}) + self.HandleFocus(types.OnFocusOpts{}) + return nil } func (self *ListContextTrait) IsItemVisible(item types.HasUrn) bool { diff --git a/pkg/gui/context/patch_explorer_context.go b/pkg/gui/context/patch_explorer_context.go index c570c323c..330f0a557 100644 --- a/pkg/gui/context/patch_explorer_context.go +++ b/pkg/gui/context/patch_explorer_context.go @@ -92,11 +92,9 @@ func (self *PatchExplorerContext) Render(isFocused bool) { self.c.Render() } -func (self *PatchExplorerContext) Focus() error { +func (self *PatchExplorerContext) Focus() { self.FocusSelection() self.c.Render() - - return nil } func (self *PatchExplorerContext) setContent(isFocused bool) { diff --git a/pkg/gui/context/simple_context.go b/pkg/gui/context/simple_context.go index 109980637..d78db7190 100644 --- a/pkg/gui/context/simple_context.go +++ b/pkg/gui/context/simple_context.go @@ -31,31 +31,26 @@ func NewDisplayContext(key types.ContextKey, view *gocui.View, windowName string ) } -func (self *SimpleContext) HandleFocus(opts types.OnFocusOpts) error { +func (self *SimpleContext) HandleFocus(opts types.OnFocusOpts) { if self.highlightOnFocus { self.GetViewTrait().SetHighlight(true) } if self.onFocusFn != nil { - if err := self.onFocusFn(opts); err != nil { - return err - } + self.onFocusFn(opts) } if self.onRenderToMainFn != nil { self.onRenderToMainFn() } - - return nil } -func (self *SimpleContext) HandleFocusLost(opts types.OnFocusLostOpts) error { +func (self *SimpleContext) HandleFocusLost(opts types.OnFocusLostOpts) { self.GetViewTrait().SetHighlight(false) self.view.SetOriginX(0) if self.onFocusLostFn != nil { - return self.onFocusLostFn(opts) + self.onFocusLostFn(opts) } - return nil } func (self *SimpleContext) HandleRender() { diff --git a/pkg/gui/controllers/base_controller.go b/pkg/gui/controllers/base_controller.go index 0b5a4042a..adff1927a 100644 --- a/pkg/gui/controllers/base_controller.go +++ b/pkg/gui/controllers/base_controller.go @@ -23,10 +23,10 @@ func (self *baseController) GetOnRenderToMain() func() { return nil } -func (self *baseController) GetOnFocus() func(types.OnFocusOpts) error { +func (self *baseController) GetOnFocus() func(types.OnFocusOpts) { return nil } -func (self *baseController) GetOnFocusLost() func(types.OnFocusLostOpts) error { +func (self *baseController) GetOnFocusLost() func(types.OnFocusLostOpts) { return nil } diff --git a/pkg/gui/controllers/bisect_controller.go b/pkg/gui/controllers/bisect_controller.go index 0db570107..122e47c61 100644 --- a/pkg/gui/controllers/bisect_controller.go +++ b/pkg/gui/controllers/bisect_controller.go @@ -290,7 +290,7 @@ func (self *BisectController) selectCurrentBisectCommit() { for i, commit := range self.c.Model().Commits { if commit.Hash == info.GetCurrentHash() { self.context().SetSelection(i) - _ = self.context().HandleFocus(types.OnFocusOpts{}) + self.context().HandleFocus(types.OnFocusOpts{}) break } } diff --git a/pkg/gui/controllers/command_log_controller.go b/pkg/gui/controllers/command_log_controller.go index 92b6540be..3056a9d96 100644 --- a/pkg/gui/controllers/command_log_controller.go +++ b/pkg/gui/controllers/command_log_controller.go @@ -26,10 +26,9 @@ func (self *CommandLogController) GetKeybindings(opts types.KeybindingsOpts) []* return bindings } -func (self *CommandLogController) GetOnFocusLost() func(types.OnFocusLostOpts) error { - return func(types.OnFocusLostOpts) error { +func (self *CommandLogController) GetOnFocusLost() func(types.OnFocusLostOpts) { + return func(types.OnFocusLostOpts) { self.c.Views().Extras.Autoscroll = true - return nil } } diff --git a/pkg/gui/controllers/commit_message_controller.go b/pkg/gui/controllers/commit_message_controller.go index 1b2c3aef8..bedc622bd 100644 --- a/pkg/gui/controllers/commit_message_controller.go +++ b/pkg/gui/controllers/commit_message_controller.go @@ -69,10 +69,9 @@ func (self *CommitMessageController) GetMouseKeybindings(opts types.KeybindingsO } } -func (self *CommitMessageController) GetOnFocusLost() func(types.OnFocusLostOpts) error { - return func(types.OnFocusLostOpts) error { +func (self *CommitMessageController) GetOnFocusLost() func(types.OnFocusLostOpts) { + return func(types.OnFocusLostOpts) { self.context().RenderCommitLength() - return nil } } diff --git a/pkg/gui/controllers/confirmation_controller.go b/pkg/gui/controllers/confirmation_controller.go index 042f83115..5f04c14a0 100644 --- a/pkg/gui/controllers/confirmation_controller.go +++ b/pkg/gui/controllers/confirmation_controller.go @@ -59,10 +59,9 @@ func (self *ConfirmationController) GetKeybindings(opts types.KeybindingsOpts) [ return bindings } -func (self *ConfirmationController) GetOnFocusLost() func(types.OnFocusLostOpts) error { - return func(types.OnFocusLostOpts) error { +func (self *ConfirmationController) GetOnFocusLost() func(types.OnFocusLostOpts) { + return func(types.OnFocusLostOpts) { self.c.Helpers().Confirmation.DeactivateConfirmationPrompt() - return nil } } diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index ad7e05fd6..2ba6eef55 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -456,7 +456,8 @@ func (self *FilesController) press(nodes []*filetree.FileNode) error { return err } - return self.context().HandleFocus(types.OnFocusOpts{}) + self.context().HandleFocus(types.OnFocusOpts{}) + return nil } func (self *FilesController) Context() types.Context { @@ -516,7 +517,8 @@ func (self *FilesController) toggleStagedAll() error { return err } - return self.context().HandleFocus(types.OnFocusOpts{}) + self.context().HandleFocus(types.OnFocusOpts{}) + return nil } func (self *FilesController) toggleStagedAllWithLock() error { diff --git a/pkg/gui/controllers/helpers/confirmation_helper.go b/pkg/gui/controllers/helpers/confirmation_helper.go index 523e99da4..5d5dcd71a 100644 --- a/pkg/gui/controllers/helpers/confirmation_helper.go +++ b/pkg/gui/controllers/helpers/confirmation_helper.go @@ -370,7 +370,7 @@ func (self *ConfirmationHelper) layoutMenuPrompt(contentWidth int) int { // Then we need to refocus to ensure the cursor is in the right place in // the view. - _ = self.c.Contexts().Menu.HandleFocus(types.OnFocusOpts{}) + self.c.Contexts().Menu.HandleFocus(types.OnFocusOpts{}) } return len(promptLines) } diff --git a/pkg/gui/controllers/list_controller.go b/pkg/gui/controllers/list_controller.go index f16d06083..dee75e414 100644 --- a/pkg/gui/controllers/list_controller.go +++ b/pkg/gui/controllers/list_controller.go @@ -73,7 +73,8 @@ func (self *ListController) HandleScrollDown() error { func (self *ListController) scrollHorizontal(scrollFunc func()) error { scrollFunc() - return self.context.HandleFocus(types.OnFocusOpts{}) + self.context.HandleFocus(types.OnFocusOpts{}) + return nil } func (self *ListController) handleLineChange(change int) error { @@ -115,7 +116,7 @@ func (self *ListController) handleLineChangeAux(f func(int), change int) error { } if cursorMoved || rangeBefore != rangeAfter { - return self.context.HandleFocus(types.OnFocusOpts{}) + self.context.HandleFocus(types.OnFocusOpts{}) } return nil @@ -142,7 +143,8 @@ func (self *ListController) HandleToggleRangeSelect() error { list.ToggleStickyRange() - return self.context.HandleFocus(types.OnFocusOpts{}) + self.context.HandleFocus(types.OnFocusOpts{}) + return nil } func (self *ListController) HandleRangeSelectDown() error { @@ -171,7 +173,8 @@ func (self *ListController) HandleClick(opts gocui.ViewMouseBindingOpts) error { if prevSelectedLineIdx == newSelectedLineIdx && alreadyFocused && self.context.GetOnClick() != nil { return self.context.GetOnClick()() } - return self.context.HandleFocus(types.OnFocusOpts{}) + self.context.HandleFocus(types.OnFocusOpts{}) + return nil } func (self *ListController) pushContextIfNotFocused() error { diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index e1faae918..486412ae6 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -1175,8 +1175,8 @@ func (self *LocalCommitsController) handleOpenLogMenu() error { }) } -func (self *LocalCommitsController) GetOnFocus() func(types.OnFocusOpts) error { - return func(types.OnFocusOpts) error { +func (self *LocalCommitsController) GetOnFocus() func(types.OnFocusOpts) { + return func(types.OnFocusOpts) { context := self.context() if context.GetSelectedLineIdx() > COMMIT_THRESHOLD && context.GetLimitCommits() { context.SetLimitCommits(false) @@ -1184,8 +1184,6 @@ func (self *LocalCommitsController) GetOnFocus() func(types.OnFocusOpts) error { return self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.COMMITS}}) }) } - - return nil } } diff --git a/pkg/gui/controllers/menu_controller.go b/pkg/gui/controllers/menu_controller.go index 61bd3b960..bf784b3af 100644 --- a/pkg/gui/controllers/menu_controller.go +++ b/pkg/gui/controllers/menu_controller.go @@ -59,13 +59,12 @@ func (self *MenuController) GetOnClick() func() error { return self.withItemGraceful(self.press) } -func (self *MenuController) GetOnFocus() func(types.OnFocusOpts) error { - return func(types.OnFocusOpts) error { +func (self *MenuController) GetOnFocus() func(types.OnFocusOpts) { + return func(types.OnFocusOpts) { selectedMenuItem := self.context().GetSelected() if selectedMenuItem != nil { self.c.Views().Tooltip.SetContent(self.c.Helpers().Confirmation.TooltipForMenuItem(selectedMenuItem)) } - return nil } } diff --git a/pkg/gui/controllers/merge_conflicts_controller.go b/pkg/gui/controllers/merge_conflicts_controller.go index 66e0153ff..2156d1e13 100644 --- a/pkg/gui/controllers/merge_conflicts_controller.go +++ b/pkg/gui/controllers/merge_conflicts_controller.go @@ -147,25 +147,21 @@ func (self *MergeConflictsController) GetMouseKeybindings(opts types.Keybindings } } -func (self *MergeConflictsController) GetOnFocus() func(types.OnFocusOpts) error { - return func(types.OnFocusOpts) error { +func (self *MergeConflictsController) GetOnFocus() func(types.OnFocusOpts) { + return func(types.OnFocusOpts) { self.c.Views().MergeConflicts.Wrap = false self.c.Helpers().MergeConflicts.Render() self.context().SetSelectedLineRange() - - return nil } } -func (self *MergeConflictsController) GetOnFocusLost() func(types.OnFocusLostOpts) error { - return func(types.OnFocusLostOpts) error { +func (self *MergeConflictsController) GetOnFocusLost() func(types.OnFocusLostOpts) { + return func(types.OnFocusLostOpts) { self.context().SetUserScrolling(false) self.context().GetState().ResetConflictSelection() self.c.Views().MergeConflicts.Wrap = true - - return nil } } diff --git a/pkg/gui/controllers/patch_building_controller.go b/pkg/gui/controllers/patch_building_controller.go index dbbdb8beb..7fbc7f697 100644 --- a/pkg/gui/controllers/patch_building_controller.go +++ b/pkg/gui/controllers/patch_building_controller.go @@ -62,24 +62,24 @@ func (self *PatchBuildingController) GetMouseKeybindings(opts types.KeybindingsO return []*gocui.ViewMouseBinding{} } -func (self *PatchBuildingController) GetOnFocus() func(types.OnFocusOpts) error { - return func(opts types.OnFocusOpts) error { +func (self *PatchBuildingController) GetOnFocus() func(types.OnFocusOpts) { + return func(opts types.OnFocusOpts) { // no need to change wrap on the secondary view because it can't be interacted with self.c.Views().PatchBuilding.Wrap = false - return self.c.Helpers().PatchBuilding.RefreshPatchBuildingPanel(opts) + // Swallowing the error here for now. This will change shortly to not + // return an error any more. + _ = self.c.Helpers().PatchBuilding.RefreshPatchBuildingPanel(opts) // FIXME } } -func (self *PatchBuildingController) GetOnFocusLost() func(types.OnFocusLostOpts) error { - return func(opts types.OnFocusLostOpts) error { +func (self *PatchBuildingController) GetOnFocusLost() func(types.OnFocusLostOpts) { + return func(opts types.OnFocusLostOpts) { self.c.Views().PatchBuilding.Wrap = true if self.c.Git().Patch.PatchBuilder.IsEmpty() { self.c.Git().Patch.PatchBuilder.Reset() } - - return nil } } diff --git a/pkg/gui/controllers/snake_controller.go b/pkg/gui/controllers/snake_controller.go index 086e42e1d..53ff054e0 100644 --- a/pkg/gui/controllers/snake_controller.go +++ b/pkg/gui/controllers/snake_controller.go @@ -52,18 +52,16 @@ func (self *SnakeController) Context() types.Context { return self.c.Contexts().Snake } -func (self *SnakeController) GetOnFocus() func(types.OnFocusOpts) error { - return func(types.OnFocusOpts) error { +func (self *SnakeController) GetOnFocus() func(types.OnFocusOpts) { + return func(types.OnFocusOpts) { self.c.Helpers().Snake.StartGame() - return nil } } -func (self *SnakeController) GetOnFocusLost() func(types.OnFocusLostOpts) error { - return func(types.OnFocusLostOpts) error { +func (self *SnakeController) GetOnFocusLost() func(types.OnFocusLostOpts) { + return func(types.OnFocusLostOpts) { self.c.Helpers().Snake.ExitGame() self.c.Helpers().Window.MoveToTopOfWindow(self.c.Contexts().Submodules) - return nil } } diff --git a/pkg/gui/controllers/staging_controller.go b/pkg/gui/controllers/staging_controller.go index b2e5667a3..b97e2b992 100644 --- a/pkg/gui/controllers/staging_controller.go +++ b/pkg/gui/controllers/staging_controller.go @@ -116,18 +116,17 @@ func (self *StagingController) GetMouseKeybindings(opts types.KeybindingsOpts) [ return []*gocui.ViewMouseBinding{} } -func (self *StagingController) GetOnFocus() func(types.OnFocusOpts) error { - return func(opts types.OnFocusOpts) error { +func (self *StagingController) GetOnFocus() func(types.OnFocusOpts) { + return func(opts types.OnFocusOpts) { self.c.Views().Staging.Wrap = false self.c.Views().StagingSecondary.Wrap = false self.c.Helpers().Staging.RefreshStagingPanel(opts) - return nil } } -func (self *StagingController) GetOnFocusLost() func(types.OnFocusLostOpts) error { - return func(opts types.OnFocusLostOpts) error { +func (self *StagingController) GetOnFocusLost() func(types.OnFocusLostOpts) { + return func(opts types.OnFocusLostOpts) { self.context.SetState(nil) if opts.NewContextKey != self.otherContext.GetKey() { @@ -136,7 +135,6 @@ func (self *StagingController) GetOnFocusLost() func(types.OnFocusLostOpts) erro self.c.Contexts().Staging.Render(false) self.c.Contexts().StagingSecondary.Render(false) } - return nil } } diff --git a/pkg/gui/controllers/sub_commits_controller.go b/pkg/gui/controllers/sub_commits_controller.go index 0e8e8b05d..69024da84 100644 --- a/pkg/gui/controllers/sub_commits_controller.go +++ b/pkg/gui/controllers/sub_commits_controller.go @@ -62,8 +62,8 @@ func (self *SubCommitsController) GetOnRenderToMain() func() { } } -func (self *SubCommitsController) GetOnFocus() func(types.OnFocusOpts) error { - return func(types.OnFocusOpts) error { +func (self *SubCommitsController) GetOnFocus() func(types.OnFocusOpts) { + return func(types.OnFocusOpts) { context := self.context() if context.GetSelectedLineIdx() > COMMIT_THRESHOLD && context.GetLimitCommits() { context.SetLimitCommits(false) @@ -71,7 +71,5 @@ func (self *SubCommitsController) GetOnFocus() func(types.OnFocusOpts) error { return self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.SUB_COMMITS}}) }) } - - return nil } } diff --git a/pkg/gui/controllers/suggestions_controller.go b/pkg/gui/controllers/suggestions_controller.go index 3908f5267..bb55b3f5d 100644 --- a/pkg/gui/controllers/suggestions_controller.go +++ b/pkg/gui/controllers/suggestions_controller.go @@ -75,10 +75,9 @@ func (self *SuggestionsController) switchToConfirmation() error { return self.c.Context().Replace(self.c.Contexts().Confirmation) } -func (self *SuggestionsController) GetOnFocusLost() func(types.OnFocusLostOpts) error { - return func(types.OnFocusLostOpts) error { +func (self *SuggestionsController) GetOnFocusLost() func(types.OnFocusLostOpts) { + return func(types.OnFocusLostOpts) { self.c.Helpers().Confirmation.DeactivateConfirmationPrompt() - return nil } } diff --git a/pkg/gui/controllers/toggle_whitespace_action.go b/pkg/gui/controllers/toggle_whitespace_action.go index f5362ddf4..4d491e79b 100644 --- a/pkg/gui/controllers/toggle_whitespace_action.go +++ b/pkg/gui/controllers/toggle_whitespace_action.go @@ -28,5 +28,6 @@ func (self *ToggleWhitespaceAction) Call() error { self.c.GetAppState().IgnoreWhitespaceInDiffView = !self.c.GetAppState().IgnoreWhitespaceInDiffView self.c.SaveAppStateAndLogError() - return self.c.Context().CurrentSide().HandleFocus(types.OnFocusOpts{}) + self.c.Context().CurrentSide().HandleFocus(types.OnFocusOpts{}) + return nil } diff --git a/pkg/gui/types/context.go b/pkg/gui/types/context.go index f923fa6b9..23ac7739b 100644 --- a/pkg/gui/types/context.go +++ b/pkg/gui/types/context.go @@ -96,15 +96,15 @@ type IBaseContext interface { AddOnClickFn(func() error) AddOnRenderToMainFn(func()) - AddOnFocusFn(func(OnFocusOpts) error) - AddOnFocusLostFn(func(OnFocusLostOpts) error) + AddOnFocusFn(func(OnFocusOpts)) + AddOnFocusLostFn(func(OnFocusLostOpts)) } type Context interface { IBaseContext - HandleFocus(opts OnFocusOpts) error - HandleFocusLost(opts OnFocusLostOpts) error + HandleFocus(opts OnFocusOpts) + HandleFocusLost(opts OnFocusLostOpts) HandleRender() HandleRenderToMain() } @@ -179,7 +179,7 @@ type IPatchExplorerContext interface { GetIncludedLineIndices() []int RenderAndFocus(isFocused bool) Render(isFocused bool) - Focus() error + Focus() GetContentToRender(isFocused bool) string NavigateTo(isFocused bool, selectedLineIdx int) GetMutex() *deadlock.Mutex @@ -233,8 +233,8 @@ type HasKeybindings interface { GetMouseKeybindings(opts KeybindingsOpts) []*gocui.ViewMouseBinding GetOnClick() func() error GetOnRenderToMain() func() - GetOnFocus() func(OnFocusOpts) error - GetOnFocusLost() func(OnFocusLostOpts) error + GetOnFocus() func(OnFocusOpts) + GetOnFocusLost() func(OnFocusLostOpts) } type IController interface { diff --git a/pkg/gui/view_helpers.go b/pkg/gui/view_helpers.go index 167c83f39..7f1023ce5 100644 --- a/pkg/gui/view_helpers.go +++ b/pkg/gui/view_helpers.go @@ -134,9 +134,7 @@ func (gui *Gui) postRefreshUpdate(c types.Context) error { c.HandleRender() if gui.currentViewName() == c.GetViewName() { - if err := c.HandleFocus(types.OnFocusOpts{}); err != nil { - return err - } + c.HandleFocus(types.OnFocusOpts{}) } return nil