1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-10 11:10:18 +02:00

Fix the commit graph display after selection jumps in commits view (#2943)

This commit is contained in:
Stefan Haller 2023-08-20 08:51:29 +02:00 committed by GitHub
commit 888a976fc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,7 +35,18 @@ func (self *ListContextTrait) FocusLine() {
// resized before we focus the line, otherwise if we're in accordion mode
// the view could be squashed and won't how to adjust the cursor/origin
self.c.AfterLayout(func() error {
oldOrigin, _ := self.GetViewTrait().ViewPortYBounds()
self.GetViewTrait().FocusPoint(self.list.GetSelectedLineIdx())
// If FocusPoint() caused the view to scroll (because the selected line
// was out of view before), we need to rerender the view port again.
// This can happen when pressing , or . to scroll by pages, or < or > to
// jump to the top or bottom.
newOrigin, _ := self.GetViewTrait().ViewPortYBounds()
if self.refreshViewportOnChange && oldOrigin != newOrigin {
self.refreshViewport()
}
return nil
})