mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-06 22:33:07 +02:00
Fix scrolling hunk into view when selecting next hunk
If the hunk to be selected was partially scrolled offscreen, the view wouldn't scroll enough to make it completely visible (the last line of the hunk was still offscreen). This is only a minimal fix for a pressing problem. The code to handle scrolling after selection changes has lots of problems, and is also inconsistent between list views and the patch explorer, but cleaning this up needs more time than I have right now.
This commit is contained in:
@ -22,7 +22,7 @@ func calculateNewOriginWithNeededAndWantedIdx(currentOrigin int, bufferHeight in
|
|||||||
allowedChange := bottom - needToSeeIdx
|
allowedChange := bottom - needToSeeIdx
|
||||||
return origin - min(requiredChange, allowedChange)
|
return origin - min(requiredChange, allowedChange)
|
||||||
} else if wantToSeeIdx >= bottom {
|
} else if wantToSeeIdx >= bottom {
|
||||||
requiredChange := wantToSeeIdx - bottom
|
requiredChange := wantToSeeIdx + 1 - bottom
|
||||||
allowedChange := needToSeeIdx - origin
|
allowedChange := needToSeeIdx - origin
|
||||||
return origin + min(requiredChange, allowedChange)
|
return origin + min(requiredChange, allowedChange)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user