Skip to content

Commit 6365528

Browse files
committed
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.
1 parent 29fc46d commit 6365528

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/gui/patch_exploring/focus.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func calculateNewOriginWithNeededAndWantedIdx(currentOrigin int, bufferHeight in
2222
allowedChange := bottom - needToSeeIdx
2323
return origin - min(requiredChange, allowedChange)
2424
} else if wantToSeeIdx >= bottom {
25-
requiredChange := wantToSeeIdx - bottom
25+
requiredChange := wantToSeeIdx + 1 - bottom
2626
allowedChange := needToSeeIdx - origin
2727
return origin + min(requiredChange, allowedChange)
2828
}

0 commit comments

Comments
 (0)