Skip to content

Commit db0a7e6

Browse files
committed
notice when the editor changed height, and update accordingly
fixes a bug where an editor with very little text wouldn't update its gutter on resize
1 parent 8fa615a commit db0a7e6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/codemirror.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ var CodeMirror = (function() {
6161
// happened during the operation.
6262
var updateInput, changes, textChanged, selectionChanged;
6363
// Current visible range (may be bigger than the view window).
64-
var showingFrom = 0, showingTo = 0;
64+
var showingFrom = 0, showingTo = 0, lastHeight = 0;
6565
// editing will hold an object describing the things we put in the
6666
// textarea, to help figure out whether something changed.
6767
// bracketHighlighted is used to remember that a backet has been
@@ -654,10 +654,11 @@ var CodeMirror = (function() {
654654

655655
// Position the mover div to align with the lines it's supposed
656656
// to be showing (which will cover the visible display)
657-
var different = from != showingFrom || to != showingTo;
657+
var different = from != showingFrom || to != showingTo || lastHeight != wrapper.clientHeight;
658658
showingFrom = from; showingTo = to;
659659
mover.style.top = (from * lineHeight()) + "px";
660660
if (different) {
661+
lastHeight = wrapper.clientHeight;
661662
code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + "px";
662663
updateGutter();
663664
}

0 commit comments

Comments
 (0)