MCPcopy Index your code
hub / github.com/DHTMLX/gantt / clipPos

Function clipPos

samples/common/codehighlight/codemirror.js:997–1002  ·  view source on GitHub ↗
(doc, pos)

Source from the content-addressed store, hash-verified

995 // actually exist within the document.
996 function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
997 function clipPos(doc, pos) {
998 if (pos.line < doc.first) { return Pos(doc.first, 0) }
999 var last = doc.first + doc.size - 1;
1000 if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
1001 return clipToLen(pos, getLine(doc, pos.line).text.length)
1002 }
1003 function clipToLen(pos, linelen) {
1004 var ch = pos.ch;
1005 if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }

Callers 14

clipPosArrayFunction · 0.85
takeTokenFunction · 0.85
estimateCoordsFunction · 0.85
endOperation_finishFunction · 0.85
filterSelectionChangeFunction · 0.85
movePosFunction · 0.85
filterChangeFunction · 0.85
markTextSharedFunction · 0.85
codemirror.jsFile · 0.85
rangeForUnitFunction · 0.85
extendToFunction · 0.85

Calls 3

PosFunction · 0.85
getLineFunction · 0.85
clipToLenFunction · 0.85

Tested by

no test coverage detected