enturn / brackets-quick-search

Notepad++ style smart highlighting extension for Brackets editor.
36 stars 11 forks source link

Markings on scrollbar can be off #15

Open Hirse opened 9 years ago

Hirse commented 9 years ago

The markings on the scrollbar for matches show the position of the line based on the total lines. If you have a lot of line wraps (in my case a long string that spanned over 50+ lines) the markings are in the wrong place.

enturn commented 9 years ago

This is a Brackets bug since I just call ScrollTrackMarkers.addTickmarks with the char and line positions that codemirror gives.

At search/ScrollTrackMarkers.js you would need to do something like (untested):

var editorWidth = editor.getScrollInfo().clientWidth; ... var wordWrapOffset = isWordWrapEnabled ? Math.floor(pos.ch / editorWidth) : 0; var top = Math.round(pos.line / editor.lineCount() * trackHt) + trackOffset + wordWrapOffset;

maxwowpow commented 9 years ago

I'm not sure but now when collapse functionality is in the core the markings are off when some objects are collapsed. Would be nice, if you could check/confirm this.

When collapsing was achieved through the extension the result was the same.

My personal thought would be to find out how collapsed sections are defined and whether there is a way to skip/adjust them when calculating the tick position. Code mirror does not do collapse, so we probably have to improvise.