(cm, pos)
| 2423 | } |
| 2424 | |
| 2425 | function scrollPosIntoView(cm, pos) { |
| 2426 | for (;;) { |
| 2427 | var changed = false, coords = cursorCoords(cm, pos); |
| 2428 | var scrollPos = calculateScrollPos(cm, coords.left, coords.top, coords.left, coords.bottom); |
| 2429 | var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft; |
| 2430 | if (scrollPos.scrollTop != null) { |
| 2431 | setScrollTop(cm, scrollPos.scrollTop); |
| 2432 | if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true; |
| 2433 | } |
| 2434 | if (scrollPos.scrollLeft != null) { |
| 2435 | setScrollLeft(cm, scrollPos.scrollLeft); |
| 2436 | if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true; |
| 2437 | } |
| 2438 | if (!changed) return coords; |
| 2439 | } |
| 2440 | } |
| 2441 | |
| 2442 | function scrollIntoView(cm, x1, y1, x2, y2) { |
| 2443 | var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2); |
no test coverage detected