MCPcopy Create free account
hub / github.com/breck7/scroll / clipToLen

Function clipToLen

external/.scrollLibs.js:1128–1137  ·  view source on GitHub ↗
(pos, linelen)

Source from the content-addressed store, hash-verified

1126 return clipToLen(pos, getLine(doc, pos.line).text.length)
1127 }
1128 function clipToLen(pos, linelen) {
1129 var ch = pos.ch
1130 if (ch == null || ch > linelen) {
1131 return Pos(pos.line, linelen)
1132 } else if (ch < 0) {
1133 return Pos(pos.line, 0)
1134 } else {
1135 return pos
1136 }
1137 }
1138 function clipPosArray(doc, array) {
1139 var out = []
1140 for (var i = 0; i < array.length; i++) {

Callers 1

clipPosFunction · 0.85

Calls 1

PosFunction · 0.85

Tested by

no test coverage detected