MCPcopy Create free account
hub / github.com/TruthHun/BookStack / clipToLen

Function clipToLen

static/mergely/lib/codemirror.js:2094–2099  ·  view source on GitHub ↗
(pos, linelen)

Source from the content-addressed store, hash-verified

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

Callers 1

clipPosFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected