MCPcopy Create free account
hub / github.com/Tampermonkey/tampermonkey / scrollCursorIntoView

Function scrollCursorIntoView

src/cm/codemirror.js:995–1012  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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;

Callers 1

endOperationFunction · 0.85

Calls 3

calculateCursorCoordsFunction · 0.85
scrollIntoViewFunction · 0.85
textHeightFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…