mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-10 04:07:18 +02:00
Refresh staging panel when committing
We now refresh the staging panel when doing an unscoped refresh, so that if we commit from the staging panel we escape back to the files panel if need be. But that causes flickering when doing an unscoped refresh from other contexts, because the refreshStagingPanel function assumes that the staging panel has focus. So we're adding a guard at the top of that function to early exit if we don't have focus.
This commit is contained in:
parent
0cd5257523
commit
9adbef40de
@ -85,6 +85,7 @@ func (gui *Gui) Refresh(options types.RefreshOptions) error {
|
||||
types.REMOTES,
|
||||
types.STATUS,
|
||||
types.BISECT_INFO,
|
||||
types.STAGING,
|
||||
})
|
||||
} else {
|
||||
scopeSet = set.NewFromSlice(options.Scope)
|
||||
@ -563,6 +564,13 @@ func (gui *Gui) refreshStatus() {
|
||||
|
||||
func (gui *Gui) refreshStagingPanel(focusOpts types.OnFocusOpts) error {
|
||||
secondaryFocused := gui.secondaryStagingFocused()
|
||||
mainFocused := gui.mainStagingFocused()
|
||||
|
||||
// this method could be called when the staging panel is not being used,
|
||||
// in which case we don't want to do anything.
|
||||
if !mainFocused && !secondaryFocused {
|
||||
return nil
|
||||
}
|
||||
|
||||
mainSelectedLineIdx := -1
|
||||
secondarySelectedLineIdx := -1
|
||||
@ -647,6 +655,10 @@ func (gui *Gui) secondaryStagingFocused() bool {
|
||||
return gui.currentStaticContext().GetKey() == gui.State.Contexts.StagingSecondary.GetKey()
|
||||
}
|
||||
|
||||
func (gui *Gui) mainStagingFocused() bool {
|
||||
return gui.currentStaticContext().GetKey() == gui.State.Contexts.Staging.GetKey()
|
||||
}
|
||||
|
||||
func (gui *Gui) refreshPatchBuildingPanel(opts types.OnFocusOpts) error {
|
||||
selectedLineIdx := -1
|
||||
if opts.ClickedWindowName == "main" {
|
||||
|
Loading…
Reference in New Issue
Block a user