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

Function adjustPos

tools/pythonauto/static/codemirrorepl/codemirrorepl.js:984–992  ·  view source on GitHub ↗
(pos)

Source from the content-addressed store, hash-verified

982 if (!to) to = from; else to = clipPos(to);
983 code = splitLines(code);
984 function adjustPos(pos) {
985 if (posLess(pos, from)) return pos;
986 if (!posLess(to, pos)) return end;
987 var line = pos.line + code.length - (to.line - from.line) - 1;
988 var ch = pos.ch;
989 if (pos.line == to.line)
990 ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));
991 return {line: line, ch: ch};
992 }
993 var end;
994 replaceRange1(code, from, to, function(end1) {
995 end = end1;

Callers 1

replaceRangeFunction · 0.70

Calls 1

posLessFunction · 0.70

Tested by

no test coverage detected