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

Function drawSelectionCursor

static/editor.md/lib/codemirror/lib/codemirror.js:2219–2235  ·  view source on GitHub ↗
(cm, range, output)

Source from the content-addressed store, hash-verified

2217
2218 // Draws a cursor for the given range
2219 function drawSelectionCursor(cm, range, output) {
2220 var pos = cursorCoords(cm, range.head, "div", null, null, !cm.options.singleCursorHeightPerLine);
2221
2222 var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
2223 cursor.style.left = pos.left + "px";
2224 cursor.style.top = pos.top + "px";
2225 cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
2226
2227 if (pos.other) {
2228 // Secondary cursor, shown when on a 'jump' in bi-directional text
2229 var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
2230 otherCursor.style.display = "";
2231 otherCursor.style.left = pos.other.left + "px";
2232 otherCursor.style.top = pos.other.top + "px";
2233 otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
2234 }
2235 }
2236
2237 // Draws the given range as a highlighted selection
2238 function drawSelectionRange(cm, range, output) {

Callers 1

prepareSelectionFunction · 0.70

Calls 2

cursorCoordsFunction · 0.70
eltFunction · 0.70

Tested by

no test coverage detected