MCPcopy
hub / github.com/DHTMLX/gantt / prepareSelection

Function prepareSelection

samples/common/codehighlight/codemirror.js:3138–3156  ·  view source on GitHub ↗
(cm, primary)

Source from the content-addressed store, hash-verified

3136 }
3137
3138 function prepareSelection(cm, primary) {
3139 if ( primary === void 0 ) primary = true;
3140
3141 var doc = cm.doc, result = {};
3142 var curFragment = result.cursors = document.createDocumentFragment();
3143 var selFragment = result.selection = document.createDocumentFragment();
3144
3145 for (var i = 0; i < doc.sel.ranges.length; i++) {
3146 if (!primary && i == doc.sel.primIndex) { continue }
3147 var range = doc.sel.ranges[i];
3148 if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }
3149 var collapsed = range.empty();
3150 if (collapsed || cm.options.showCursorWhenSelecting)
3151 { drawSelectionCursor(cm, range.head, curFragment); }
3152 if (!collapsed)
3153 { drawSelectionRange(cm, range, selFragment); }
3154 }
3155 return result
3156 }
3157
3158 // Draws a cursor for the given range
3159 function drawSelectionCursor(cm, head, output) {

Callers 1

codemirror.jsFile · 0.85

Calls 2

drawSelectionCursorFunction · 0.85
drawSelectionRangeFunction · 0.85

Tested by

no test coverage detected