mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-03-17 21:18:31 +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
a57310df24
commit
af97bf484c
pkg/gui/controllers/helpers
@ -80,6 +80,7 @@ func (self *RefreshHelper) Refresh(options types.RefreshOptions) error {
|
||||
types.REMOTES,
|
||||
types.STATUS,
|
||||
types.BISECT_INFO,
|
||||
types.STAGING,
|
||||
})
|
||||
} else {
|
||||
scopeSet = set.NewFromSlice(options.Scope)
|
||||
|
@ -21,6 +21,13 @@ func NewStagingHelper(
|
||||
// NOTE: used from outside this file
|
||||
func (self *StagingHelper) RefreshStagingPanel(focusOpts types.OnFocusOpts) error {
|
||||
secondaryFocused := self.secondaryStagingFocused()
|
||||
mainFocused := self.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
|
||||
@ -109,3 +116,7 @@ func (self *StagingHelper) handleStagingEscape() error {
|
||||
func (self *StagingHelper) secondaryStagingFocused() bool {
|
||||
return self.c.CurrentStaticContext().GetKey() == self.c.Contexts().StagingSecondary.GetKey()
|
||||
}
|
||||
|
||||
func (self *StagingHelper) mainStagingFocused() bool {
|
||||
return self.c.CurrentStaticContext().GetKey() == self.c.Contexts().Staging.GetKey()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user