(cm, pos, dir, unit)
| 11971 | // "page" or "line". The resulting position will have a hitSide=true |
| 11972 | // property if it reached the end of the document. |
| 11973 | function findPosV(cm, pos, dir, unit) { |
| 11974 | var doc = cm.doc, |
| 11975 | x = pos.left, |
| 11976 | y |
| 11977 | if (unit == "page") { |
| 11978 | var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight) |
| 11979 | var moveAmount = Math.max(pageSize - 0.5 * textHeight(cm.display), 3) |
| 11980 | y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount |
| 11981 | } else if (unit == "line") { |
| 11982 | y = dir > 0 ? pos.bottom + 3 : pos.top - 3 |
| 11983 | } |
| 11984 | var target |
| 11985 | for (;;) { |
| 11986 | target = coordsChar(cm, x, y) |
| 11987 | if (!target.outside) { |
| 11988 | break |
| 11989 | } |
| 11990 | if (dir < 0 ? y <= 0 : y >= doc.height) { |
| 11991 | target.hitSide = true |
| 11992 | break |
| 11993 | } |
| 11994 | y += dir * 5 |
| 11995 | } |
| 11996 | return target |
| 11997 | } |
| 11998 | |
| 11999 | // CONTENTEDITABLE INPUT STYLE |
| 12000 |
no test coverage detected