diff --git a/lib/codemirror.js b/lib/codemirror.js
index 88f992d8afaeab66bb10afe820a0019e00ccf613..cdf7652e72d49d81754c528af5b4d7da3a95df69 100644
--- a/lib/codemirror.js
+++ b/lib/codemirror.js
@@ -409,14 +409,14 @@ window.CodeMirror = (function() {
   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 (;;) {
+    for (var first = true;; first = false) {
       var oldWidth = cm.display.scroller.clientWidth;
       if (!updateDisplayInner(cm, changes, visible, forced)) break;
       updated = true;
       changes = [];
       updateSelection(cm);
       updateScrollbars(cm);
-      if (cm.options.lineWrapping && oldWidth != cm.display.scroller.clientWidth) {
+      if (first && cm.options.lineWrapping && oldWidth != cm.display.scroller.clientWidth) {
         forced = true;
         continue;
       }