MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / alignHorizontally

Function alignHorizontally

static/js/codemirror/codemirror.js:358–368  ·  view source on GitHub ↗
(cm)

Source from the content-addressed store, hash-verified

356 // LINE NUMBERS
357
358 function alignHorizontally(cm) {
359 var display = cm.display;
360 if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;
361 var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
362 var gutterW = display.gutters.offsetWidth, l = comp + "px";
363 for (var n = display.lineDiv.firstChild; n; n = n.nextSibling) if (n.alignable) {
364 for (var i = 0, a = n.alignable; i < a.length; ++i) a[i].style.left = l;
365 }
366 if (cm.options.fixedGutter)
367 display.gutters.style.left = (comp + gutterW) + "px";
368 }
369
370 function maybeUpdateLineNumberWidth(cm) {
371 if (!cm.options.lineNumbers) return false;

Callers 2

endOperationFunction · 0.85
setScrollLeftFunction · 0.85

Calls 1

compensateForHScrollFunction · 0.85

Tested by

no test coverage detected