MCPcopy
hub / github.com/witheve/Eve / prepareSelection

Function prepareSelection

src/codemirror.js:2311–2327  ·  view source on GitHub ↗
(cm, primary)

Source from the content-addressed store, hash-verified

2309 }
2310
2311 function prepareSelection(cm, primary) {
2312 var doc = cm.doc, result = {};
2313 var curFragment = result.cursors = document.createDocumentFragment();
2314 var selFragment = result.selection = document.createDocumentFragment();
2315
2316 for (var i = 0; i < doc.sel.ranges.length; i++) {
2317 if (primary === false && i == doc.sel.primIndex) continue;
2318 var range = doc.sel.ranges[i];
2319 if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) continue;
2320 var collapsed = range.empty();
2321 if (collapsed || cm.options.showCursorWhenSelecting)
2322 drawSelectionCursor(cm, range.head, curFragment);
2323 if (!collapsed)
2324 drawSelectionRange(cm, range, selFragment);
2325 }
2326 return result;
2327 }
2328
2329 // Draws a cursor for the given range
2330 function drawSelectionCursor(cm, head, output) {

Callers 1

codemirror.jsFile · 0.85

Calls 4

drawSelectionCursorFunction · 0.85
drawSelectionRangeFunction · 0.85
fromMethod · 0.80
toMethod · 0.80

Tested by

no test coverage detected