(cm, pos, dir, unit)
| 2555 | } |
| 2556 | |
| 2557 | function findPosV(cm, pos, dir, unit) { |
| 2558 | var doc = cm.doc, x = pos.left, y; |
| 2559 | if (unit == "page") { |
| 2560 | var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight); |
| 2561 | y = pos.top + dir * pageSize; |
| 2562 | } else if (unit == "line") { |
| 2563 | y = dir > 0 ? pos.bottom + 3 : pos.top - 3; |
| 2564 | } |
| 2565 | for (;;) { |
| 2566 | var target = coordsChar(cm, x, y); |
| 2567 | if (!target.outside) break; |
| 2568 | if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; } |
| 2569 | y += dir * 5; |
| 2570 | } |
| 2571 | return target; |
| 2572 | } |
| 2573 | |
| 2574 | function findWordAt(line, pos) { |
| 2575 | var start = pos.ch, end = pos.ch; |
no test coverage detected