MCPcopy Create free account
hub / github.com/breck7/scroll / addLineWidget

Function addLineWidget

external/.scrollLibs.js:7790–7818  ·  view source on GitHub ↗
(doc, handle, node, options)

Source from the content-addressed store, hash-verified

7788 }
7789
7790 function addLineWidget(doc, handle, node, options) {
7791 var widget = new LineWidget(doc, node, options)
7792 var cm = doc.cm
7793 if (cm && widget.noHScroll) {
7794 cm.display.alignWidgets = true
7795 }
7796 changeLine(doc, handle, "widget", function (line) {
7797 var widgets = line.widgets || (line.widgets = [])
7798 if (widget.insertAt == null) {
7799 widgets.push(widget)
7800 } else {
7801 widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget)
7802 }
7803 widget.line = line
7804 if (cm && !lineIsHidden(doc, line)) {
7805 var aboveVisible = heightAtLine(line) < doc.scrollTop
7806 updateLineHeight(line, line.height + widgetHeight(widget))
7807 if (aboveVisible) {
7808 addToScrollTop(cm, widget.height)
7809 }
7810 cm.curOp.forceUpdate = true
7811 }
7812 return true
7813 })
7814 if (cm) {
7815 signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle))
7816 }
7817 return widget
7818 }
7819
7820 // TEXTMARKERS
7821

Callers 1

.scrollLibs.jsFile · 0.85

Calls 10

changeLineFunction · 0.85
lineIsHiddenFunction · 0.85
heightAtLineFunction · 0.85
updateLineHeightFunction · 0.85
widgetHeightFunction · 0.85
addToScrollTopFunction · 0.85
signalLaterFunction · 0.85
lineNoFunction · 0.85
minMethod · 0.80
maxMethod · 0.80

Tested by

no test coverage detected