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

Function adjustForChange

tools/pythonauto/static/codemirrorepl/codemirror.js:3188–3195  ·  view source on GitHub ↗
(pos, change)

Source from the content-addressed store, hash-verified

3186 // Adjust a position to refer to the post-change position of the
3187 // same text, or the end of the change if the change covers it.
3188 function adjustForChange(pos, change) {
3189 if (cmp(pos, change.from) < 0) return pos;
3190 if (cmp(pos, change.to) <= 0) return changeEnd(change);
3191
3192 var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
3193 if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;
3194 return Pos(line, ch);
3195 }
3196
3197 function computeSelAfterChange(doc, change) {
3198 var out = [];

Callers 1

computeSelAfterChangeFunction · 0.85

Calls 2

cmpFunction · 0.85
PosFunction · 0.85

Tested by

no test coverage detected