Skip to content

Commit

Permalink
fixed #173858 minimap slider not scrolling to the top end (#180728)
Browse files Browse the repository at this point in the history
fixed div/0 in minimap slider position calculation

also execute if block if scrollTop equals options.paddingTop
this avoids div/0 in else block when options.paddingTop is 0
  • Loading branch information
Dromantor committed Jul 26, 2023
1 parent 4b947b8 commit 6c8d3ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/vs/editor/browser/viewParts/minimap/minimap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ class MinimapLayout {
const partialLine = (scrollTop - viewportStartLineNumberVerticalOffset) / lineHeight;

let sliderTopAligned: number;
if (scrollTop > options.paddingTop) {
if (scrollTop >= options.paddingTop) {
sliderTopAligned = (viewportStartLineNumber - startLineNumber + topPaddingLineCount + partialLine) * minimapLineHeight / pixelRatio;
} else {
sliderTopAligned = (scrollTop / options.paddingTop) * (topPaddingLineCount + partialLine) * minimapLineHeight / pixelRatio;
Expand Down

0 comments on commit 6c8d3ea

Please sign in to comment.