code: function updateDisplay(cm, changes, viewPort, forced) {
      var oldFrom = cm.display.showingFrom, oldTo = cm.display.showingTo, updated;
      var visible = visibleLines(cm.display, cm.doc, viewPort);
      for (;;) {
        if (!updateDisplayInner(cm, changes, visible, forced)) break;
        forced = false;
        updated = true;
        updateSelection(cm);
        updateScrollbars(cm);
  
        // Clip forced viewport to actual scrollable area
        if (viewPort)
          viewPort = Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight,
                              typeof viewPort == "number" ? viewPort : viewPort.top);
        visible = visibleLines(cm.display, cm.doc, viewPort);
        if (visible.from >= cm.display.showingFrom && visible.to <= cm.display.showingTo)
          break;
        changes = [];
      }
  
      if (updated) {
        signalLater(cm, "update", cm);
        if (cm.display.showingFrom != oldFrom || cm.display.showingTo != oldTo)
          signalLater(cm, "viewportChange", cm, cm.display.showingFrom, cm.display.showingTo);
      }
      return updated;
    }
docs: DISPLAY DRAWING