MCPcopy
hub / github.com/witheve/Eve / addLineWidget

Function addLineWidget

src/codemirror.js:6713–6731  ·  view source on GitHub ↗
(doc, handle, node, options)

Source from the content-addressed store, hash-verified

6711 }
6712
6713 function addLineWidget(doc, handle, node, options) {
6714 var widget = new LineWidget(doc, node, options);
6715 var cm = doc.cm;
6716 if (cm && widget.noHScroll) cm.display.alignWidgets = true;
6717 changeLine(doc, handle, "widget", function(line) {
6718 var widgets = line.widgets || (line.widgets = []);
6719 if (widget.insertAt == null) widgets.push(widget);
6720 else widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget);
6721 widget.line = line;
6722 if (cm && !lineIsHidden(doc, line)) {
6723 var aboveVisible = heightAtLine(line) < doc.scrollTop;
6724 updateLineHeight(line, line.height + widgetHeight(widget));
6725 if (aboveVisible) addToScrollPos(cm, null, widget.height);
6726 cm.curOp.forceUpdate = true;
6727 }
6728 return true;
6729 });
6730 return widget;
6731 }
6732
6733 // LINE DATA STRUCTURE
6734

Callers 1

codemirror.jsFile · 0.85

Calls 6

changeLineFunction · 0.85
lineIsHiddenFunction · 0.85
heightAtLineFunction · 0.85
updateLineHeightFunction · 0.85
widgetHeightFunction · 0.85
addToScrollPosFunction · 0.85

Tested by

no test coverage detected