(cm, handle, node, options)
| 5469 | } |
| 5470 | |
| 5471 | function addLineWidget(cm, handle, node, options) { |
| 5472 | var widget = new LineWidget(cm, node, options); |
| 5473 | if (widget.noHScroll) cm.display.alignWidgets = true; |
| 5474 | changeLine(cm, handle, "widget", function(line) { |
| 5475 | var widgets = line.widgets || (line.widgets = []); |
| 5476 | if (widget.insertAt == null) widgets.push(widget); |
| 5477 | else widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); |
| 5478 | widget.line = line; |
| 5479 | if (!lineIsHidden(cm.doc, line)) { |
| 5480 | var aboveVisible = heightAtLine(line) < cm.doc.scrollTop; |
| 5481 | updateLineHeight(line, line.height + widgetHeight(widget)); |
| 5482 | if (aboveVisible) addToScrollPos(cm, null, widget.height); |
| 5483 | cm.curOp.forceUpdate = true; |
| 5484 | } |
| 5485 | return true; |
| 5486 | }); |
| 5487 | return widget; |
| 5488 | } |
| 5489 | |
| 5490 | // LINE DATA STRUCTURE |
| 5491 |
no test coverage detected