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

Function clipPos

tools/pythonauto/static/codemirror/codemirror.js:2546–2551  ·  view source on GitHub ↗
(doc, pos)

Source from the content-addressed store, hash-verified

2544
2545 function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1));}
2546 function clipPos(doc, pos) {
2547 if (pos.line < doc.first) return Pos(doc.first, 0);
2548 var last = doc.first + doc.size - 1;
2549 if (pos.line > last) return Pos(last, getLine(doc, last).text.length);
2550 return clipToLen(pos, getLine(doc, pos.line).text.length);
2551 }
2552 function clipToLen(pos, linelen) {
2553 var ch = pos.ch;
2554 if (ch == null || ch > linelen) return Pos(pos.line, linelen);

Callers 11

endOperationFunction · 0.70
onMouseDownFunction · 0.70
doSelectFunction · 0.70
loadFileFunction · 0.70
clipPostChangeFunction · 0.70
filterChangeFunction · 0.70
filterSelectionChangeFunction · 0.70
skipAtomicFunction · 0.70
selectLineFunction · 0.70
codemirror.jsFile · 0.70
markTextSharedFunction · 0.70

Calls 3

PosFunction · 0.85
getLineFunction · 0.70
clipToLenFunction · 0.70

Tested by

no test coverage detected