From 7ff0977bf6d6b53a1d416689d03977688e9ec9a0 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 15 Aug 2026 18:20:24 +0200 Subject: [PATCH] Take the focused main view's context by its concrete type Both callers pass a main context, and focusing one is about to need more of it than the Context interface offers. Saying so in the signature also retires the type assertion that was there only to reach ClearSearchString. Co-authored-by: Claude Opus 5 (1M context) --- .../controllers/switch_to_focused_main_view_controller.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/gui/controllers/switch_to_focused_main_view_controller.go b/pkg/gui/controllers/switch_to_focused_main_view_controller.go index 5606a0bab..a44d2dd1d 100644 --- a/pkg/gui/controllers/switch_to_focused_main_view_controller.go +++ b/pkg/gui/controllers/switch_to_focused_main_view_controller.go @@ -2,6 +2,7 @@ package controllers import ( "github.com/jesseduffield/lazygit/pkg/gocui" + "github.com/jesseduffield/lazygit/pkg/gui/context" "github.com/jesseduffield/lazygit/pkg/gui/types" ) @@ -72,10 +73,8 @@ func (self *SwitchToFocusedMainViewController) handleFocusMainView() error { return self.focusMainView(self.c.Contexts().Normal) } -func (self *SwitchToFocusedMainViewController) focusMainView(mainViewContext types.Context) error { - if context, ok := mainViewContext.(types.ISearchableContext); ok { - context.ClearSearchString() - } +func (self *SwitchToFocusedMainViewController) focusMainView(mainViewContext *context.MainContext) error { + mainViewContext.ClearSearchString() self.c.Context().Push(mainViewContext, types.OnFocusOpts{}) return nil }