MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / clipLine

Function clipLine

lib/web/CodeMirror/src/line/pos.js:23–23  ·  view source on GitHub ↗
(doc, n)

Source from the content-addressed store, hash-verified

21// Most of the external API clips given positions to make sure they
22// actually exist within the document.
23export function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
24export function clipPos(doc, pos) {
25 if (pos.line < doc.first) return Pos(doc.first, 0)
26 let last = doc.first + doc.size - 1

Callers 2

changeLineFunction · 0.90
methods.jsFile · 0.90

Calls 2

maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected