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() + } + } } }