fix initial highlighting in hidden editor

This commit is contained in:
nightwing 2013-06-19 21:25:39 +04:00
commit 2852638c45
2 changed files with 8 additions and 5 deletions

View file

@ -64,8 +64,6 @@ $(function() {
tabs.find(tab_a_selector).click(function(e) {
e.preventDefault();
embedded_editor.resize();
editor.resize();
if ($(this).attr("href") === "/") {
window.location = "http://ace.ajax.org";
return;
@ -102,6 +100,8 @@ $(function() {
}
$(this).tab("show");
embedded_editor.resize();
editor.resize();
var state = {};
state.nav = $(this).attr("href").substr(1);

View file

@ -270,6 +270,7 @@ var VirtualRenderer = function(container, theme) {
this.$textLayer.checkForSizeChanges();
};
this.$changes = 0;
/**
* [Triggers a resize of the editor.]{: #VirtualRenderer.onResize}
* @param {Boolean} force If `true`, recomputes the size, even if the height and width haven't changed
@ -280,7 +281,7 @@ var VirtualRenderer = function(container, theme) {
*
**/
this.onResize = function(force, gutterWidth, width, height) {
var changes = 0;
var changes = this.$changes || 0;
var size = this.$size;
if (this.resizing > 2)
@ -644,8 +645,10 @@ var VirtualRenderer = function(container, theme) {
};
this.$renderChanges = function(changes, force) {
if (!force && (!changes || !this.session || !this.container.offsetWidth))
return;
if (!force && (!changes || !this.session || !this.container.offsetWidth)) {
this.$changes = changes;
return;
}
this._signal("beforeRender");
// text, scrolling and resize changes can cause the view port size to change