Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jul 26, 2023

Conversation

Dromantor
Copy link
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.

Copy link

@cyber-eternal cyber-eternal left a comment

Choose a reason for hiding this comment

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

LGTM

also execute if block if scrollTop equals options.paddingTop
this avoids div/0 in else block when options.paddingTop is 0
@Dromantor
Copy link
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
Copy link
Member

@alexdima alexdima left a comment

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
6 checks passed
@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.

None yet

4 participants