MCPcopy
hub / github.com/csev/py4e / drawSelectionCursor

Function drawSelectionCursor

tools/pythonauto/static/codemirrorepl/codemirror.js:1256–1272  ·  view source on GitHub ↗
(cm, range, output)

Source from the content-addressed store, hash-verified

1254
1255 // Draws a cursor for the given range
1256 function drawSelectionCursor(cm, range, output) {
1257 var pos = cursorCoords(cm, range.head, "div");
1258
1259 var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
1260 cursor.style.left = pos.left + "px";
1261 cursor.style.top = pos.top + "px";
1262 cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
1263
1264 if (pos.other) {
1265 // Secondary cursor, shown when on a 'jump' in bi-directional text
1266 var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
1267 otherCursor.style.display = "";
1268 otherCursor.style.left = pos.other.left + "px";
1269 otherCursor.style.top = pos.other.top + "px";
1270 otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
1271 }
1272 }
1273
1274 // Draws the given range as a highlighted selection
1275 function drawSelectionRange(cm, range, output) {

Callers 1

updateSelectionFunction · 0.85

Calls 3

cursorCoordsFunction · 0.70
eltFunction · 0.70
appendChildMethod · 0.45

Tested by

no test coverage detected