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

Function clipToLen

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

Source from the content-addressed store, hash-verified

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);
2555 else if (ch < 0) return Pos(pos.line, 0);
2556 else return pos;
2557 }
2558 function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size;}
2559
2560 // If shift is held, this will move the selection anchor. Otherwise,

Callers 2

clipPostChangeFunction · 0.70
clipPosFunction · 0.70

Calls 1

PosFunction · 0.85

Tested by

no test coverage detected