(doc, handle, node, options)
| 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 |
no test coverage detected