fix #1266: Scroller is collapsed when ace initialized with empty value

This commit is contained in:
nightwing 2013-02-27 11:39:47 +04:00
commit 402cdad04b
2 changed files with 8 additions and 6 deletions

View file

@ -91,7 +91,7 @@ exports.edit = function(el) {
var env = { var env = {
document: doc, document: doc,
editor: editor, editor: editor,
onResize: editor.resize.bind(editor) onResize: editor.resize.bind(editor, null)
}; };
event.addListener(window, "resize", env.onResize); event.addListener(window, "resize", env.onResize);
editor.on("destroy", function() { editor.on("destroy", function() {

View file

@ -262,12 +262,10 @@ var VirtualRenderer = function(container, theme) {
* *
**/ **/
this.updateFull = function(force) { this.updateFull = function(force) {
if (force){ if (force)
this.$renderChanges(this.CHANGE_FULL, true); this.$renderChanges(this.CHANGE_FULL, true);
} else
else {
this.$loop.schedule(this.CHANGE_FULL); this.$loop.schedule(this.CHANGE_FULL);
}
}; };
/** /**
@ -288,7 +286,7 @@ var VirtualRenderer = function(container, theme) {
* *
**/ **/
this.onResize = function(force, gutterWidth, width, height) { this.onResize = function(force, gutterWidth, width, height) {
var changes = this.CHANGE_SIZE; var changes = 0;
var size = this.$size; var size = this.$size;
if (this.resizing > 2) if (this.resizing > 2)
@ -302,6 +300,7 @@ var VirtualRenderer = function(container, theme) {
if (height && (force || size.height != height)) { if (height && (force || size.height != height)) {
size.height = height; size.height = height;
changes = this.CHANGE_SIZE;
size.scrollerHeight = this.scroller.clientHeight; size.scrollerHeight = this.scroller.clientHeight;
if (!size.scrollerHeight) { if (!size.scrollerHeight) {
@ -321,6 +320,7 @@ var VirtualRenderer = function(container, theme) {
width = dom.getInnerWidth(this.container); width = dom.getInnerWidth(this.container);
if (width && (force || this.resizing > 1 || size.width != width)) { if (width && (force || this.resizing > 1 || size.width != width)) {
changes = this.CHANGE_SIZE;
size.width = width; size.width = width;
var gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0; var gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;
@ -740,6 +740,8 @@ var VirtualRenderer = function(container, theme) {
}; };
this.$computeLayerConfig = function() { this.$computeLayerConfig = function() {
if (!this.$size.scrollerHeight)
return this.onResize(true);
var session = this.session; var session = this.session;
var offset = this.scrollTop % this.lineHeight; var offset = this.scrollTop % this.lineHeight;