From 4e21a096b950e2840ccfd54e9ac0ad43f0d21a33 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Wed, 26 Mar 2025 14:39:44 +0100 Subject: [PATCH] Re-render focused main view on refresh if needed --- pkg/gui/view_helpers.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/gui/view_helpers.go b/pkg/gui/view_helpers.go index bf83fd7f3..706f5863b 100644 --- a/pkg/gui/view_helpers.go +++ b/pkg/gui/view_helpers.go @@ -4,6 +4,7 @@ import ( "time" "github.com/jesseduffield/gocui" + "github.com/jesseduffield/lazygit/pkg/gui/context" "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/jesseduffield/lazygit/pkg/tasks" "github.com/jesseduffield/lazygit/pkg/utils" @@ -143,5 +144,17 @@ func (gui *Gui) postRefreshUpdate(c types.Context) { // correctly, and that integration tests see the up to date selection // state. c.FocusLine() + + currentCtx := gui.State.ContextMgr.Current() + if currentCtx.GetKey() == context.NORMAL_MAIN_CONTEXT_KEY || currentCtx.GetKey() == context.NORMAL_SECONDARY_CONTEXT_KEY { + // Searching can't cope well with the view being updated while it is being searched. + // We might be able to fix the problems with this, but it doesn't seem easy, so for now + // just don't rerender the view while searching, on the assumption that users will probably + // either search or change their data, but not both at the same time. + if !currentCtx.GetView().IsSearching() { + parentCtx := currentCtx.GetParentContext() + parentCtx.HandleRenderToMain() + } + } } }