MCPcopy Create free account
hub / github.com/TruthHun/BookStack / drawSelectionCursor

Function drawSelectionCursor

static/mergely/lib/codemirror.js:2322–2338  ·  view source on GitHub ↗
(cm, head, output)

Source from the content-addressed store, hash-verified

2320
2321 // Draws a cursor for the given range
2322 function drawSelectionCursor(cm, head, output) {
2323 var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
2324
2325 var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
2326 cursor.style.left = pos.left + "px";
2327 cursor.style.top = pos.top + "px";
2328 cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
2329
2330 if (pos.other) {
2331 // Secondary cursor, shown when on a 'jump' in bi-directional text
2332 var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
2333 otherCursor.style.display = "";
2334 otherCursor.style.left = pos.other.left + "px";
2335 otherCursor.style.top = pos.other.top + "px";
2336 otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
2337 }
2338 }
2339
2340 // Draws the given range as a highlighted selection
2341 function drawSelectionRange(cm, range, output) {

Callers 2

prepareSelectionFunction · 0.70
onDragOverFunction · 0.70

Calls 2

cursorCoordsFunction · 0.70
eltFunction · 0.70

Tested by

no test coverage detected