(cm, head, output)
| 30 | |
| 31 | // Draws a cursor for the given range |
| 32 | export function drawSelectionCursor(cm, head, output) { |
| 33 | let pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine) |
| 34 | |
| 35 | let cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor")) |
| 36 | cursor.style.left = pos.left + "px" |
| 37 | cursor.style.top = pos.top + "px" |
| 38 | cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px" |
| 39 | |
| 40 | if (pos.other) { |
| 41 | // Secondary cursor, shown when on a 'jump' in bi-directional text |
| 42 | let otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor")) |
| 43 | otherCursor.style.display = "" |
| 44 | otherCursor.style.left = pos.other.left + "px" |
| 45 | otherCursor.style.top = pos.other.top + "px" |
| 46 | otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px" |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | function cmpCoords(a, b) { return a.top - b.top || a.left - b.left } |
| 51 |
no test coverage detected