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

Function movePos

static/mergely/lib/codemirror.js:2286–2296  ·  view source on GitHub ↗
(doc, pos, dir, line)

Source from the content-addressed store, hash-verified

2284 }
2285
2286 function movePos(doc, pos, dir, line) {
2287 if (dir < 0 && pos.ch == 0) {
2288 if (pos.line > doc.first) return clipPos(doc, Pos(pos.line - 1));
2289 else return null;
2290 } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
2291 if (pos.line < doc.first + doc.size - 1) return Pos(pos.line + 1, 0);
2292 else return null;
2293 } else {
2294 return new Pos(pos.line, pos.ch + dir);
2295 }
2296 }
2297
2298 // SELECTION DRAWING
2299

Callers 1

skipAtomicInnerFunction · 0.85

Calls 2

clipPosFunction · 0.70
getLineFunction · 0.70

Tested by

no test coverage detected