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

Function adjustForChange

src/codemirror.js:4309–4316  ·  view source on GitHub ↗
(pos, change)

Source from the content-addressed store, hash-verified

4307 // Adjust a position to refer to the post-change position of the
4308 // same text, or the end of the change if the change covers it.
4309 function adjustForChange(pos, change) {
4310 if (cmp(pos, change.from) < 0) return pos;
4311 if (cmp(pos, change.to) <= 0) return changeEnd(change);
4312
4313 var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
4314 if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;
4315 return Pos(line, ch);
4316 }
4317
4318 function computeSelAfterChange(doc, change) {
4319 var out = [];

Callers 1

computeSelAfterChangeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected