Skip to content

Commit cc5951d

Browse files
authored
Enforce revealing padding to be at most half the viewport (microsoft#226610)
Fixes microsoft#216843
1 parent 32b4b6b commit cc5951d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/vs/editor/browser/viewParts/lines/viewLines.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -705,12 +705,10 @@ export class ViewLines extends ViewPart implements IViewLines {
705705
let paddingBottom: number = 0;
706706

707707
if (!shouldIgnoreScrollOff) {
708-
const context = Math.min((viewportHeight / this._lineHeight) / 2, this._cursorSurroundingLines);
709-
if (this._stickyScrollEnabled) {
710-
paddingTop = Math.max(context, this._maxNumberStickyLines) * this._lineHeight;
711-
} else {
712-
paddingTop = context * this._lineHeight;
713-
}
708+
const maxLinesInViewport = (viewportHeight / this._lineHeight);
709+
const surroundingLines = Math.max(this._cursorSurroundingLines, this._stickyScrollEnabled ? this._maxNumberStickyLines : 0);
710+
const context = Math.min(maxLinesInViewport / 2, surroundingLines);
711+
paddingTop = context * this._lineHeight;
714712
paddingBottom = Math.max(0, (context - 1)) * this._lineHeight;
715713
} else {
716714
if (!minimalReveal) {

0 commit comments

Comments
 (0)