From d675117289cc195b7cae105a808a29383f48d9d4 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Thu, 13 Apr 2023 11:13:57 +0200 Subject: Fix activation of initial context This broke with 40f6767cfc77; the symptom is that starting lazygit with a git arg (e.g. "lazygit log") wouldn't activate the requested panel correctly. While it would show in the expanded view, it didn't have a green frame, and keyboard events would go to the files panel. --- pkg/gui/gui_common.go | 4 ++++ pkg/gui/layout.go | 2 +- pkg/gui/types/common.go | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/gui/gui_common.go b/pkg/gui/gui_common.go index 835aa4f54..01c73ad9a 100644 --- a/pkg/gui/gui_common.go +++ b/pkg/gui/gui_common.go @@ -70,6 +70,10 @@ func (self *guiCommon) IsCurrentContext(c types.Context) bool { return self.CurrentContext().GetKey() == c.GetKey() } +func (self *guiCommon) ActivateContext(context types.Context) error { + return self.gui.activateContext(context, types.OnFocusOpts{}) +} + func (self *guiCommon) GetAppState() *config.AppState { return self.gui.Config.GetAppState() } diff --git a/pkg/gui/layout.go b/pkg/gui/layout.go index 0deb37d2e..14e1973bc 100644 --- a/pkg/gui/layout.go +++ b/pkg/gui/layout.go @@ -182,7 +182,7 @@ func (gui *Gui) onInitialViewsCreationForRepo() error { } initialContext := gui.currentSideContext() - if err := gui.c.PushContext(initialContext); err != nil { + if err := gui.c.ActivateContext(initialContext); err != nil { return err } diff --git a/pkg/gui/types/common.go b/pkg/gui/types/common.go index aeb1da4c0..5711800f5 100644 --- a/pkg/gui/types/common.go +++ b/pkg/gui/types/common.go @@ -45,6 +45,7 @@ type IGuiCommon interface { CurrentContext() Context CurrentStaticContext() Context IsCurrentContext(Context) bool + ActivateContext(context Context) error // enters search mode for the current view OpenSearch() -- cgit v1.2.3