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

Function clipLine

external/.scrollLibs.js:1115–1117  ·  view source on GitHub ↗
(doc, n)

Source from the content-addressed store, hash-verified

1113 // Most of the external API clips given positions to make sure they
1114 // actually exist within the document.
1115 function clipLine(doc, n) {
1116 return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))
1117 }
1118 function clipPos(doc, pos) {
1119 if (pos.line < doc.first) {
1120 return Pos(doc.first, 0)

Callers 2

changeLineFunction · 0.70
addEditorMethodsFunction · 0.70

Calls 2

maxMethod · 0.80
minMethod · 0.80

Tested by

no test coverage detected