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

Improve search tick mark positioning - #11293

Merged
marcelgerber merged 1 commit into
masterfrom
marcel/scroll-marks-fixes
Jul 27, 2016
Merged

marcelgerber merged 1 commit into
masterfrom
marcel/scroll-marks-fixes

Conversation

@marcelgerber

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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).

Comment thread src/search/ScrollTrackMarkers.js Outdated
} else { //(Linux)
trackOffset = 2; // Custom scrollbar CSS has assymmetrical gap; this approximates it
}
trackOffset = scrollbarTrackOffset;

Copy link
Copy Markdown
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
Copy Markdown
Collaborator

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

@marcelgerber
marcelgerber force-pushed the marcel/scroll-marks-fixes branch from 3d73ef2 to be899a2 Compare July 26, 2016 13:41

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

Copy link
Copy Markdown
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
Copy Markdown
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

d-akara commented Jul 26, 2016

Copy link
Copy Markdown
Contributor

@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
Copy Markdown
Contributor Author

@ficristo Changed that doc too 👍

Comment thread src/search/ScrollTrackMarkers.js Outdated
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
Copy Markdown
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
Copy Markdown
Collaborator

@dakaraphi Thank you to have checked.

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

@marcelgerber
marcelgerber force-pushed the marcel/scroll-marks-fixes branch from 716bfe6 to cd7c836 Compare July 27, 2016 18:32
@marcelgerber
marcelgerber force-pushed the marcel/scroll-marks-fixes branch from cd7c836 to 6da3ed8 Compare July 27, 2016 18:33
@marcelgerber

Copy link
Copy Markdown
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