MCPcopy Index your code
hub / github.com/csev/py4e / filterSelectionChange

Function filterSelectionChange

tools/pythonauto/static/codemirrorepl/codemirror.js:1094–1108  ·  view source on GitHub ↗
(doc, sel)

Source from the content-addressed store, hash-verified

1092 // Give beforeSelectionChange handlers a change to influence a
1093 // selection update.
1094 function filterSelectionChange(doc, sel) {
1095 var obj = {
1096 ranges: sel.ranges,
1097 update: function(ranges) {
1098 this.ranges = [];
1099 for (var i = 0; i < ranges.length; i++)
1100 this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
1101 clipPos(doc, ranges[i].head));
1102 }
1103 };
1104 signal(doc, "beforeSelectionChange", doc, obj);
1105 if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj);
1106 if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);
1107 else return sel;
1108 }
1109
1110 function setSelectionReplaceHistory(doc, sel, options) {
1111 var done = doc.history.done, last = lst(done);

Callers 1

setSelectionNoUndoFunction · 0.70

Calls 3

signalFunction · 0.85
normalizeSelectionFunction · 0.85
clipPosFunction · 0.70

Tested by

no test coverage detected