()
| 993 | } |
| 994 | |
| 995 | function scrollCursorIntoView() { |
| 996 | var coords = calculateCursorCoords(); |
| 997 | scrollIntoView(coords.x, coords.y, coords.x, coords.yBot); |
| 998 | if (!focused) return; |
| 999 | var box = sizer.getBoundingClientRect(), doScroll = null; |
| 1000 | if (coords.y + box.top < 0) doScroll = true; |
| 1001 | else if (coords.y + box.top + textHeight() > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false; |
| 1002 | if (doScroll != null) { |
| 1003 | var hidden = cursor.style.display == "none"; |
| 1004 | if (hidden) { |
| 1005 | cursor.style.display = ""; |
| 1006 | cursor.style.left = coords.x + "px"; |
| 1007 | cursor.style.top = (coords.y - displayOffset) + "px"; |
| 1008 | } |
| 1009 | cursor.scrollIntoView(doScroll); |
| 1010 | if (hidden) cursor.style.display = "none"; |
| 1011 | } |
| 1012 | } |
| 1013 | function calculateCursorCoords() { |
| 1014 | var cursor = localCoords(sel.inverted ? sel.from : sel.to); |
| 1015 | var x = options.lineWrapping ? Math.min(cursor.x, lineSpace.offsetWidth) : cursor.x; |
no test coverage detected
searching dependent graphs…