(doc, handle, node, options)
| 5714 | } |
| 5715 | |
| 5716 | function addLineWidget(doc, handle, node, options) { |
| 5717 | var widget = new LineWidget(doc, node, options); |
| 5718 | var cm = doc.cm; |
| 5719 | if (cm && widget.noHScroll) { cm.display.alignWidgets = true; } |
| 5720 | changeLine(doc, handle, "widget", function (line) { |
| 5721 | var widgets = line.widgets || (line.widgets = []); |
| 5722 | if (widget.insertAt == null) { widgets.push(widget); } |
| 5723 | else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); } |
| 5724 | widget.line = line; |
| 5725 | if (cm && !lineIsHidden(doc, line)) { |
| 5726 | var aboveVisible = heightAtLine(line) < doc.scrollTop; |
| 5727 | updateLineHeight(line, line.height + widgetHeight(widget)); |
| 5728 | if (aboveVisible) { addToScrollTop(cm, widget.height); } |
| 5729 | cm.curOp.forceUpdate = true; |
| 5730 | } |
| 5731 | return true |
| 5732 | }); |
| 5733 | if (cm) { signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle)); } |
| 5734 | return widget |
| 5735 | } |
| 5736 | |
| 5737 | // TEXTMARKERS |
| 5738 |
no test coverage detected