Skip to content

fixed #173858 minimap slider not scrolling to the top end #180728

Merged
alexdima merged 2 commits into
microsoft:mainfrom
Dromantor:fix_minimap_slider
Jul 26, 2023
Merged

fixed #173858 minimap slider not scrolling to the top end #180728
alexdima merged 2 commits into
microsoft:mainfrom
Dromantor:fix_minimap_slider

Conversation

@Dromantor

Copy link
Copy Markdown
Contributor

This fixes the issue #173858 I reported a few weeks ago.

When scrolling all the way to the top a div/0 happens in the else block when options.paddingTop == scrollTop == 0:

[line 380 in minimap.ts]
if (scrollTop > options.paddingTop) {
    sliderTopAligned = (viewportStartLineNumber - startLineNumber + topPaddingLineCount + partialLine) * minimapLineHeight / pixelRatio;
} else {
    sliderTopAligned = (scrollTop / options.paddingTop) * (topPaddingLineCount + partialLine) * minimapLineHeight / pixelRatio;
                                [ ^ div/0 ]
}

My pull request changes the if condition to >= instead of >, avoiding the div/0 by executing the else block.
(Reasoning: Why should the calculation suddenly completely change when scrollTop, i.e. the position from the top end, changes from 1 to 0? It probably shouldn't.)

Tested it by modifying my local installation, where it completely eliminated the issue.

@cyber-eternal cyber-eternal left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexdima alexdima self-requested a review April 28, 2023 10:29
@Dromantor Dromantor force-pushed the fix_minimap_slider branch from acd43e0 to 1c04e39 Compare July 19, 2023 09:43
also execute if block if scrollTop equals options.paddingTop
this avoids div/0 in else block when options.paddingTop is 0
@Dromantor Dromantor force-pushed the fix_minimap_slider branch from 1c04e39 to fab0084 Compare July 19, 2023 09:53
@Dromantor

Copy link
Copy Markdown
Contributor Author

I would really like if this obvious but simple to fix issue does not persist for another 10 months.

@alexdima alexdima added this to the July 2023 milestone Jul 26, 2023

@alexdima alexdima left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you and appologies for the slow reaction times!

@alexdima alexdima merged commit 6c8d3ea into microsoft:main Jul 26, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants