MCPcopy
hub / github.com/witheve/Eve / clipToLen

Function clipToLen

src/codemirror.js:2099–2104  ·  view source on GitHub ↗
(pos, linelen)

Source from the content-addressed store, hash-verified

2097 return clipToLen(pos, getLine(doc, pos.line).text.length);
2098 }
2099 function clipToLen(pos, linelen) {
2100 var ch = pos.ch;
2101 if (ch == null || ch > linelen) return Pos(pos.line, linelen);
2102 else if (ch < 0) return Pos(pos.line, 0);
2103 else return pos;
2104 }
2105 function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size;}
2106 function clipPosArray(doc, array) {
2107 for (var out = [], i = 0; i < array.length; i++) out[i] = clipPos(doc, array[i]);

Callers 1

clipPosFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected