MCPcopy Create free account
hub / github.com/breck7/scroll / drawSelectionCursor

Function drawSelectionCursor

external/.scrollLibs.js:4467–4483  ·  view source on GitHub ↗
(cm, head, output)

Source from the content-addressed store, hash-verified

4465
4466 // Draws a cursor for the given range
4467 function drawSelectionCursor(cm, head, output) {
4468 var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine)
4469
4470 var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"))
4471 cursor.style.left = pos.left + "px"
4472 cursor.style.top = pos.top + "px"
4473 cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"
4474
4475 if (pos.other) {
4476 // Secondary cursor, shown when on a 'jump' in bi-directional text
4477 var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"))
4478 otherCursor.style.display = ""
4479 otherCursor.style.left = pos.other.left + "px"
4480 otherCursor.style.top = pos.other.top + "px"
4481 otherCursor.style.height = (pos.other.bottom - pos.other.top) * 0.85 + "px"
4482 }
4483 }
4484
4485 function cmpCoords(a, b) {
4486 return a.top - b.top || a.left - b.left

Callers 2

prepareSelectionFunction · 0.85
onDragOverFunction · 0.85

Calls 3

cursorCoordsFunction · 0.85
eltFunction · 0.85
maxMethod · 0.80

Tested by

no test coverage detected