(cm, pos, dir, unit)
| 4685 | // "page" or "line". The resulting position will have a hitSide=true |
| 4686 | // property if it reached the end of the document. |
| 4687 | function findPosV(cm, pos, dir, unit) { |
| 4688 | var doc = cm.doc, x = pos.left, y; |
| 4689 | if (unit == "page") { |
| 4690 | var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight); |
| 4691 | y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display)); |
| 4692 | } else if (unit == "line") { |
| 4693 | y = dir > 0 ? pos.bottom + 3 : pos.top - 3; |
| 4694 | } |
| 4695 | for (;;) { |
| 4696 | var target = coordsChar(cm, x, y); |
| 4697 | if (!target.outside) break; |
| 4698 | if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; } |
| 4699 | y += dir * 5; |
| 4700 | } |
| 4701 | return target; |
| 4702 | } |
| 4703 | |
| 4704 | // EDITOR METHODS |
| 4705 |
no test coverage detected