Skip to content

Commit

Permalink
Amend c8c7fc1 to handle window resize-tiggered updated
Browse files Browse the repository at this point in the history
Issue #1787
  • Loading branch information
marijnh committed Sep 9, 2013
1 parent c8c7fc1 commit 7ea6f43
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ window.CodeMirror = (function() {

if (mac_geLion && scrollbarWidth(d.measure) === 0)
d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? "18px" : "12px";
return needsV;
}

function visibleLines(display, doc, viewPort) {
Expand Down Expand Up @@ -411,12 +410,16 @@ window.CodeMirror = (function() {
var oldFrom = cm.display.showingFrom, oldTo = cm.display.showingTo, updated;
var visible = visibleLines(cm.display, cm.doc, viewPort);
for (;;) {
var hadVScroll = cm.display.scroller.scrollHeight > cm.display.scroller.clientHeight + 1;
var oldWidth = cm.display.scroller.clientWidth;
if (!updateDisplayInner(cm, changes, visible, forced)) break;
updated = true;
changes = [];
updateSelection(cm);
if (updateScrollbars(cm) != hadVScroll) continue;
updateScrollbars(cm);
if (cm.options.lineWrapping && oldWidth != cm.display.scroller.clientWidth) {
forced = true;
continue;
}
forced = false;

// Clip forced viewport to actual scrollable area
Expand Down

0 comments on commit 7ea6f43

Please sign in to comment.