(cm, viewPort, forced)
| 531 | // unless forced is true. |
| 532 | // Returns true if an actual update happened, false otherwise. |
| 533 | function updateDisplay(cm, viewPort, forced) { |
| 534 | var oldFrom = cm.display.viewFrom, oldTo = cm.display.viewTo, updated; |
| 535 | var visible = visibleLines(cm.display, cm.doc, viewPort); |
| 536 | for (var first = true;; first = false) { |
| 537 | var oldWidth = cm.display.scroller.clientWidth; |
| 538 | if (!updateDisplayInner(cm, visible, forced)) break; |
| 539 | updated = true; |
| 540 | |
| 541 | // If the max line changed since it was last measured, measure it, |
| 542 | // and ensure the document's width matches it. |
| 543 | if (cm.display.maxLineChanged && !cm.options.lineWrapping) |
| 544 | adjustContentWidth(cm); |
| 545 | |
| 546 | var barMeasure = measureForScrollbars(cm); |
| 547 | updateSelection(cm); |
| 548 | setDocumentHeight(cm, barMeasure); |
| 549 | updateScrollbars(cm, barMeasure); |
| 550 | if (first && cm.options.lineWrapping && oldWidth != cm.display.scroller.clientWidth) { |
| 551 | forced = true; |
| 552 | continue; |
| 553 | } |
| 554 | forced = false; |
| 555 | |
| 556 | // Clip forced viewport to actual scrollable area. |
| 557 | if (viewPort && viewPort.top != null) |
| 558 | viewPort = {top: Math.min(barMeasure.docHeight - scrollerCutOff - barMeasure.clientHeight, viewPort.top)}; |
| 559 | // Updated line heights might result in the drawn area not |
| 560 | // actually covering the viewport. Keep looping until it does. |
| 561 | visible = visibleLines(cm.display, cm.doc, viewPort); |
| 562 | if (visible.from >= cm.display.viewFrom && visible.to <= cm.display.viewTo) |
| 563 | break; |
| 564 | } |
| 565 | |
| 566 | cm.display.updateLineNumbers = null; |
| 567 | if (updated) { |
| 568 | signalLater(cm, "update", cm); |
| 569 | if (cm.display.viewFrom != oldFrom || cm.display.viewTo != oldTo) |
| 570 | signalLater(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo); |
| 571 | } |
| 572 | return updated; |
| 573 | } |
| 574 | |
| 575 | // Does the actual updating of the line display. Bails out |
| 576 | // (returning false) when there is nothing to be done and forced is |
no test coverage detected