(cm, coords)
| 3471 | // If an editor sits on the top or bottom of the window, partially |
| 3472 | // scrolled out of view, this ensures that the cursor is visible. |
| 3473 | function maybeScrollWindow(cm, coords) { |
| 3474 | var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null; |
| 3475 | if (coords.top + box.top < 0) doScroll = true; |
| 3476 | else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false; |
| 3477 | if (doScroll != null && !phantom) { |
| 3478 | var scrollNode = elt("div", "\u200b", null, "position: absolute; top: " + |
| 3479 | (coords.top - display.viewOffset - paddingTop(cm.display)) + "px; height: " + |
| 3480 | (coords.bottom - coords.top + scrollerCutOff) + "px; left: " + |
| 3481 | coords.left + "px; width: 2px;"); |
| 3482 | cm.display.lineSpace.appendChild(scrollNode); |
| 3483 | scrollNode.scrollIntoView(doScroll); |
| 3484 | cm.display.lineSpace.removeChild(scrollNode); |
| 3485 | } |
| 3486 | } |
| 3487 | |
| 3488 | // Scroll a given position into view (immediately), verifying that |
| 3489 | // it actually became visible (as line heights are accurately |
no test coverage detected