MCPcopy
hub / github.com/csev/py4e / clipToLen

Function clipToLen

tools/pythonauto/static/codemirrorepl/codemirror.js:1026–1031  ·  view source on GitHub ↗
(pos, linelen)

Source from the content-addressed store, hash-verified

1024 return clipToLen(pos, getLine(doc, pos.line).text.length);
1025 }
1026 function clipToLen(pos, linelen) {
1027 var ch = pos.ch;
1028 if (ch == null || ch > linelen) return Pos(pos.line, linelen);
1029 else if (ch < 0) return Pos(pos.line, 0);
1030 else return pos;
1031 }
1032 function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size;}
1033 function clipPosArray(doc, array) {
1034 for (var out = [], i = 0; i < array.length; i++) out[i] = clipPos(doc, array[i]);

Callers 1

clipPosFunction · 0.70

Calls 1

PosFunction · 0.85

Tested by

no test coverage detected