MCPcopy Create free account
hub / github.com/feiyu563/PrometheusAlert / adjustForChange

Function adjustForChange

static/plugins/codemirror/codemirror.js:4680–4687  ·  view source on GitHub ↗
(pos, change)

Source from the content-addressed store, hash-verified

4678 // Adjust a position to refer to the post-change position of the
4679 // same text, or the end of the change if the change covers it.
4680 function adjustForChange(pos, change) {
4681 if (cmp(pos, change.from) < 0) { return pos }
4682 if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
4683
4684 var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
4685 if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }
4686 return Pos(line, ch)
4687 }
4688
4689 function computeSelAfterChange(doc, change) {
4690 var out = [];

Callers 1

computeSelAfterChangeFunction · 0.85

Calls 3

changeEndFunction · 0.85
PosFunction · 0.85
cmpFunction · 0.70

Tested by

no test coverage detected