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

Function filterSelectionChange

src/codemirror.js:2167–2182  ·  view source on GitHub ↗
(doc, sel, options)

Source from the content-addressed store, hash-verified

2165 // Give beforeSelectionChange handlers a change to influence a
2166 // selection update.
2167 function filterSelectionChange(doc, sel, options) {
2168 var obj = {
2169 ranges: sel.ranges,
2170 update: function(ranges) {
2171 this.ranges = [];
2172 for (var i = 0; i < ranges.length; i++)
2173 this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
2174 clipPos(doc, ranges[i].head));
2175 },
2176 origin: options && options.origin
2177 };
2178 signal(doc, "beforeSelectionChange", doc, obj);
2179 if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj);
2180 if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);
2181 else return sel;
2182 }
2183
2184 function setSelectionReplaceHistory(doc, sel, options) {
2185 var done = doc.history.done, last = lst(done);

Callers 1

setSelectionNoUndoFunction · 0.85

Calls 2

clipPosFunction · 0.85
normalizeSelectionFunction · 0.85

Tested by

no test coverage detected