Skip to content

Commit ef83a91

Browse files
committed
make sure a window resize causes a full refresh
1 parent 65351b7 commit ef83a91

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/codemirror.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ var CodeMirror = (function() {
7676
// Register our event handlers.
7777
connect(wrapper, "mousedown", operation(onMouseDown));
7878
connect(code, "dblclick", operation(onDblClick));
79-
connect(wrapper, "scroll", function() {updateDisplay(); if (options.onScroll) options.onScroll(instance);});
80-
connect(window, "resize", updateDisplay);
79+
connect(wrapper, "scroll", function() {updateDisplay([]); if (options.onScroll) options.onScroll(instance);});
80+
connect(window, "resize", function() {updateDisplay(true);});
8181
connect(input, "keyup", operation(onKeyUp));
8282
connect(input, "keydown", operation(onKeyDown));
8383
connect(input, "keypress", onKeyPress);
@@ -160,7 +160,7 @@ var CodeMirror = (function() {
160160
getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));},
161161

162162
operation: function(f){return operation(f)();},
163-
refresh: function(){updateDisplay([{from: 0, to: lines.length}]);},
163+
refresh: function(){updateDisplay(true);},
164164
getInputField: function(){return input;},
165165
getWrapperElement: function(){return wrapper;}
166166
};
@@ -598,8 +598,8 @@ var CodeMirror = (function() {
598598
if (!wrapper.clientWidth) return;
599599
// First create a range of theoretically intact lines, and punch
600600
// holes in that using the change info.
601-
var intact = [{from: showingFrom, to: showingTo, domStart: 0}];
602-
for (var i = 0, l = changes ? changes.length : 0; i < l; ++i) {
601+
var intact = changes === true ? [] : [{from: showingFrom, to: showingTo, domStart: 0}];
602+
for (var i = 0, l = changes.length || 0; i < l; ++i) {
603603
var change = changes[i], intact2 = [], diff = change.diff || 0;
604604
for (var j = 0, l2 = intact.length; j < l2; ++j) {
605605
var range = intact[j];

mode/javascript/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
<script src="javascript.js"></script>
88
<link rel="stylesheet" href="javascript.css">
99
<link rel="stylesheet" href="../../docs.css">
10-
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
10+
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black; height: auto}</style>
1111
</head>
1212
<body>
1313
<h1>CodeMirror 2: JavaScript mode</h1>
1414

15-
<form><textarea id="code" name="code">
15+
<div><textarea id="code" name="code">
1616
// Demo code (the actual new parser character stream implementation)
1717

1818
function StringStream(string) {
@@ -60,7 +60,7 @@ <h1>CodeMirror 2: JavaScript mode</h1>
6060
}
6161
}
6262
};
63-
</textarea></form>
63+
</textarea></div>
6464

6565
<script>
6666
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {

0 commit comments

Comments
 (0)