Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Improve search tick mark positioning #11293

Merged
merged 1 commit into from
Jul 27, 2016
Merged

Conversation

marcelgerber
Copy link
Contributor

For #11079.

This does not only fix the "scrollPastEnd" issue, but also ones where scroll tick marks were inaccurately placed in minified lines, and so on.

Also adds new getScrollbarTrackOffset/setScrollbarTrackOffset methods which can be utilized by extensions.

Notice though that this new method is more expensive, so we should look out for performance regressions!

@abose abose added this to the Release 1.4 milestone Jun 19, 2015
@marcelgerber marcelgerber removed this from the Release 1.4 milestone Jul 24, 2015
@ficristo
Copy link
Collaborator

There was an issue like this on CodeMirror: can we use that logic?
The code on CodeMirror changed since this PR, can you update the PR to reflect the new changes?

If there aren't specific requests, can you avoid exposing the setter/getter of scrollbarTrackOffset?

@marcelgerber
Copy link
Contributor Author

I've already had the appropriate code in there to calculate the scroll height, but I've changed it because CMs code seems to be a tiny bit faster.
The reason the getter and setter is exposed is maybe a bit selfish, but my extension Scroll Arrows would make use of them (it's probably the only one that does so, though).

} else { //(Linux)
trackOffset = 2; // Custom scrollbar CSS has assymmetrical gap; this approximates it
}
trackOffset = scrollbarTrackOffset;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use the getter?

@ficristo
Copy link
Collaborator

I left some comments.
I guess the temp folder weren't meant to be committed 😄


/**
* @param {number} offset Amount of vertical space above and below the scrollbar, in pixels
*/
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you change the JSDoc here too, to give it a proper description?

@ficristo
Copy link
Collaborator

Since you have an use case I'm fine with the setter/getter.

@marcelgerber @dakaraphi do you know how this will interact with #12442?
I don't see any changes there on ScrollTrackMarkers.js file but I wonder if there could be any problem.

@d-akara
Copy link
Contributor

d-akara commented Jul 26, 2016

@ficristo @marcelgerber just looking at the changes here I don't see that this would interact with the tick mark optimizations for search in #12442

@marcelgerber
Copy link
Contributor Author

@ficristo Changed that doc too 👍

posArray.forEach(function (pos) {
var top = Math.round(pos.line / editor.lineCount() * trackHt) + trackOffset;
var cursorTop = getY(cm, pos);
var top = Math.round(cursorTop / editorHt * trackHt) + trackOffset;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I missed this before, sorry, but it should be a single var

@ficristo
Copy link
Collaborator

@dakaraphi Thank you to have checked.

@marcelgerber I left a small nit, LGTM with or without it.

@marcelgerber
Copy link
Contributor Author

@ficristo Thanks for reviewing!
Merging.

@marcelgerber marcelgerber merged commit ed9edd3 into master Jul 27, 2016
@marcelgerber marcelgerber deleted the marcel/scroll-marks-fixes branch July 27, 2016 18:37
@ficristo ficristo added this to the Release 1.8 milestone Aug 2, 2016
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