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

Function adjustPos

tools/pythonauto/static/codemirror/codemirror.js:2317–2324  ·  view source on GitHub ↗
(pos)

Source from the content-addressed store, hash-verified

2315
2316 // hint is null, leave the selection alone as much as possible
2317 var adjustPos = function(pos) {
2318 if (posLess(pos, change.from)) return pos;
2319 if (!posLess(change.to, pos)) return end;
2320
2321 var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
2322 if (pos.line == change.to.line) ch += end.ch - change.to.ch;
2323 return Pos(line, ch);
2324 };
2325 return {anchor: adjustPos(doc.sel.anchor), head: adjustPos(doc.sel.head)};
2326 }
2327

Callers 1

computeSelAfterChangeFunction · 0.70

Calls 2

PosFunction · 0.85
posLessFunction · 0.70

Tested by

no test coverage detected