mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-06-20 01:19:23 +02:00
When pressing up or down, scroll selection into view if it is outside, even if it didn't change
We have this logic to avoid constantly rerendering the main view when hitting up-arrow when you are already at the top of the list. That's good, but we do want to scroll the selection into view if it is outside and you hit up or down, no matter if it changed.
This commit is contained in:
@@ -117,6 +117,11 @@ func (self *ListController) handleLineChangeAux(f func(int), change int) error {
|
||||
|
||||
if cursorMoved || rangeBefore != rangeAfter {
|
||||
self.context.HandleFocus(types.OnFocusOpts{ScrollSelectionIntoView: true})
|
||||
} else {
|
||||
// If the selection did not change (because, for example, we are at the top of the list and
|
||||
// press up), we still want to ensure that the selection is visible. This is useful after
|
||||
// scrolling the selection out of view with the mouse.
|
||||
self.context.FocusLine(true)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user