MCPcopy Create free account
hub / github.com/TruthHun/BookStack / alignHorizontally

Function alignHorizontally

static/editor.md/lib/codemirror/lib/codemirror.js:567–581  ·  view source on GitHub ↗
(cm)

Source from the content-addressed store, hash-verified

565 // Re-align line numbers and gutter marks to compensate for
566 // horizontal scrolling.
567 function alignHorizontally(cm) {
568 var display = cm.display, view = display.view;
569 if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;
570 var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
571 var gutterW = display.gutters.offsetWidth, left = comp + "px";
572 for (var i = 0; i < view.length; i++) if (!view[i].hidden) {
573 if (cm.options.fixedGutter && view[i].gutter)
574 view[i].gutter.style.left = left;
575 var align = view[i].alignable;
576 if (align) for (var j = 0; j < align.length; j++)
577 align[j].style.left = left;
578 }
579 if (cm.options.fixedGutter)
580 display.gutters.style.left = (comp + gutterW) + "px";
581 }
582
583 // Used to ensure that the line number gutter is still the right
584 // size for the current document size. Returns true when an update

Callers 3

guttersChangedFunction · 0.70
endOperation_finishFunction · 0.70
setScrollLeftFunction · 0.70

Calls 1

compensateForHScrollFunction · 0.70

Tested by

no test coverage detected