(cm, pos, dir, unit)
| 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 |
no test coverage detected