MCPcopy
hub / github.com/witheve/Eve / findPosV

Function findPosV

src/codemirror.js:4891–4906  ·  view source on GitHub ↗
(cm, pos, dir, unit)

Source from the content-addressed store, hash-verified

4889 // "page" or "line". The resulting position will have a hitSide=true
4890 // property if it reached the end of the document.
4891 function findPosV(cm, pos, dir, unit) {
4892 var doc = cm.doc, x = pos.left, y;
4893 if (unit == "page") {
4894 var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
4895 y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));
4896 } else if (unit == "line") {
4897 y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
4898 }
4899 for (;;) {
4900 var target = coordsChar(cm, x, y);
4901 if (!target.outside) break;
4902 if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }
4903 y += dir * 5;
4904 }
4905 return target;
4906 }
4907
4908 // EDITOR METHODS
4909

Callers 1

codemirror.jsFile · 0.85

Calls 2

textHeightFunction · 0.85
coordsCharFunction · 0.85

Tested by

no test coverage detected