src/search/ScrollTrackMarkers.js
function _renderMarks(posArray) {
        var html = "",
            cm = editor._codeMirror,
            editorHt = cm.getScrollerElement().scrollHeight;

        // We've pretty much taken these vars and the getY function from CodeMirror's annotatescrollbar addon
        // https://github.com/codemirror/CodeMirror/blob/master/addon/scroll/annotatescrollbar.js
        var wrapping = cm.getOption("lineWrapping"),
            singleLineH = wrapping && cm.defaultTextHeight() * 1.5,
            curLine = null,
            curLineObj = null;

        function getY(cm, pos) {
            if (curLine !== pos.line) {
                curLine = pos.line;
                curLineObj = cm.getLineHandle(curLine);
            }
            if (wrapping && curLineObj.height > singleLineH) {
                return cm.charCoords(pos, "local").top;
            }
            return cm.heightAtLine(curLineObj, "local");
        }

        posArray.forEach(function (pos) {
            var cursorTop = getY(cm, pos),
                top = Math.round(cursorTop / editorHt * trackHt) + trackOffset;
            top--;  // subtract ~1/2 the ht of a tickmark to center it on ideal pos

            html += "<div class='tickmark' style='top:" + top + "px'></div>";
        });
        $(".tickmark-track", editor.getRootElement()).append($(html));
    }
function _renderMarks(posArray) {
        var html = "",
            cm = editor._codeMirror,
            editorHt = cm.getScrollerElement().scrollHeight;

        // We've pretty much taken these vars and the getY function from CodeMirror's annotatescrollbar addon
        // https://github.com/codemirror/CodeMirror/blob/master/addon/scroll/annotatescrollbar.js
        var wrapping = cm.getOption("lineWrapping"),
            singleLineH = wrapping && cm.defaultTextHeight() * 1.5,
            curLine = null,
            curLineObj = null;

        function getY(cm, pos) {
            if (curLine !== pos.line) {
                curLine = pos.line;
                curLineObj = cm.getLineHandle(curLine);
            }
            if (wrapping && curLineObj.height > singleLineH) {
                return cm.charCoords(pos, "local").top;
            }
            return cm.heightAtLine(curLineObj, "local");
        }

        posArray.forEach(function (pos) {
            var cursorTop = getY(cm, pos),
                top = Math.round(cursorTop / editorHt * trackHt) + trackOffset;
            top--;  // subtract ~1/2 the ht of a tickmark to center it on ideal pos

            html += "<div class='tickmark' style='top:" + top + "px'></div>";
        });
        $(".tickmark-track", editor.getRootElement()).append($(html));
    }
function _renderMarks ( posArray ) { var html = "" , cm = editor . _codeMirror , editorHt = cm . getScrollerElement ( ) . scrollHeight ; // We've pretty much taken these vars and the getY function from CodeMirror's annotatescrollbar addon // https://github.com/codemirror/CodeMirror/blob/master/addon/scroll/annotatescrollbar.js var wrapping = cm . getOption ( "lineWrapping" ) , singleLineH = wrapping && cm . defaultTextHeight ( ) * 1.5 , curLine = null , curLineObj = null ; function getY ( cm , pos ) { if ( curLine !== pos . line ) { curLine = pos . line ; curLineObj = cm . getLineHandle ( curLine ) ; } if ( wrapping && curLineObj . height > singleLineH ) { return cm . charCoords ( pos , "local" ) . top ; } return cm . heightAtLine ( curLineObj , "local" ) ; } posArray . forEach ( function ( pos ) { var cursorTop = getY ( cm , pos ) , top = Math . round ( cursorTop / editorHt * trackHt ) + trackOffset ; top -- ; // subtract ~1/2 the ht of a tickmark to center it on ideal pos html += "<div class='tickmark' style='top:" + top + "px'></div>" ; } ) ; $ ( ".tickmark-track" , editor . getRootElement ( ) ) . append ( $ ( html ) ) ; }
Add all the given tickmarks to the DOM in a batch
Add all the given tickmarks to the DOM in a batch