mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-25 22:32:13 +02:00
Re-render focused main view on refresh if needed
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
"github.com/jesseduffield/lazygit/pkg/tasks"
|
"github.com/jesseduffield/lazygit/pkg/tasks"
|
||||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
"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
|
// correctly, and that integration tests see the up to date selection
|
||||||
// state.
|
// state.
|
||||||
c.FocusLine()
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user