mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
Refresh commits viewport on focus lost
We don't want the highlighted selection sticking around after the context loses focus.
This commit is contained in:
parent
caab31ff38
commit
c9136538b5
3 changed files with 14 additions and 10 deletions
|
@ -21,7 +21,7 @@ type ListContextTrait struct {
|
|||
// TODO: now that we allow scrolling, we should be smarter about what gets refreshed:
|
||||
// we should find out exactly which lines are now part of the path and refresh those.
|
||||
// We should also keep track of the previous path and refresh those lines too.
|
||||
refreshViewportOnLineFocus bool
|
||||
refreshViewportOnChange bool
|
||||
}
|
||||
|
||||
func (self *ListContextTrait) IsListContext() {}
|
||||
|
@ -34,7 +34,7 @@ func (self *ListContextTrait) FocusLine() {
|
|||
self.GetViewTrait().FocusPoint(self.list.GetSelectedLineIdx())
|
||||
self.setFooter()
|
||||
|
||||
if self.refreshViewportOnLineFocus {
|
||||
if self.refreshViewportOnChange {
|
||||
self.refreshViewport()
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,10 @@ func (self *ListContextTrait) HandleFocus(opts types.OnFocusOpts) error {
|
|||
func (self *ListContextTrait) HandleFocusLost(opts types.OnFocusLostOpts) error {
|
||||
self.GetViewTrait().SetOriginX(0)
|
||||
|
||||
if self.refreshViewportOnChange {
|
||||
self.refreshViewport()
|
||||
}
|
||||
|
||||
return self.Context.HandleFocusLost(opts)
|
||||
}
|
||||
|
||||
|
|
|
@ -67,10 +67,10 @@ func NewLocalCommitsContext(c *ContextCommon) *LocalCommitsContext {
|
|||
Kind: types.SIDE_CONTEXT,
|
||||
Focusable: true,
|
||||
})),
|
||||
list: viewModel,
|
||||
getDisplayStrings: getDisplayStrings,
|
||||
c: c,
|
||||
refreshViewportOnLineFocus: true,
|
||||
list: viewModel,
|
||||
getDisplayStrings: getDisplayStrings,
|
||||
c: c,
|
||||
refreshViewportOnChange: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,10 +72,10 @@ func NewSubCommitsContext(
|
|||
Focusable: true,
|
||||
Transient: true,
|
||||
})),
|
||||
list: viewModel,
|
||||
getDisplayStrings: getDisplayStrings,
|
||||
c: c,
|
||||
refreshViewportOnLineFocus: true,
|
||||
list: viewModel,
|
||||
getDisplayStrings: getDisplayStrings,
|
||||
c: c,
|
||||
refreshViewportOnChange: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue