MCPcopy Index your code
hub / github.com/csev/py4e / findPosV

Function findPosV

tools/pythonauto/static/codemirror/codemirror.js:2866–2881  ·  view source on GitHub ↗
(cm, pos, dir, unit)

Source from the content-addressed store, hash-verified

2864 }
2865
2866 function findPosV(cm, pos, dir, unit) {
2867 var doc = cm.doc, x = pos.left, y;
2868 if (unit == "page") {
2869 var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
2870 y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));
2871 } else if (unit == "line") {
2872 y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
2873 }
2874 for (;;) {
2875 var target = coordsChar(cm, x, y);
2876 if (!target.outside) break;
2877 if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }
2878 y += dir * 5;
2879 }
2880 return target;
2881 }
2882
2883 function findWordAt(line, pos) {
2884 var start = pos.ch, end = pos.ch;

Callers 1

codemirror.jsFile · 0.70

Calls 2

textHeightFunction · 0.70
coordsCharFunction · 0.70

Tested by

no test coverage detected