Permalink
Browse files

[scrollpastend plugin] Don't get confused when the editor changes size

Closes #2160
  • Loading branch information...
1 parent 9ad6218 commit 2dcfbd67d3b2019e03fc6ea0bd93991f170fa8b3 @marijnh marijnh committed Jan 22, 2014
Showing with 4 additions and 0 deletions.
  1. +2 −0 addon/scroll/scrollpastend.js
  2. +2 −0 lib/codemirror.js
@@ -4,11 +4,13 @@
CodeMirror.defineOption("scrollPastEnd", false, function(cm, val, old) {
if (old && old != CodeMirror.Init) {
cm.off("change", onChange);
+ cm.off("refresh", updateBottomMargin);
cm.display.lineSpace.parentNode.style.paddingBottom = "";
cm.state.scrollPastEndPadding = null;
}
if (val) {
cm.on("change", onChange);
+ cm.on("refresh", updateBottomMargin);
updateBottomMargin(cm);
}
});
View
@@ -3265,6 +3265,7 @@ window.CodeMirror = (function() {
if (this.options.lineWrapping)
this.display.measureLineCache.length = this.display.measureLineCachePos = 0;
this.curOp.forceUpdate = true;
+ signal(this, "refresh", this);
}),
operation: function(f){return runInOp(this, f);},
@@ -3276,6 +3277,7 @@ window.CodeMirror = (function() {
regChange(this);
if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)
estimateLineHeights(this);
+ signal(this, "refresh", this);
}),
swapDoc: operation(null, function(doc) {

0 comments on commit 2dcfbd6

Please sign in to comment.