From 2852638c45a0a6f770594a13c5e67acc3548ecff Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 19 Jun 2013 21:25:39 +0400 Subject: [PATCH] fix initial highlighting in hidden editor --- doc/site/js/main.js | 4 ++-- lib/ace/virtual_renderer.js | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/site/js/main.js b/doc/site/js/main.js index b52d6f6b..b7d61fae 100644 --- a/doc/site/js/main.js +++ b/doc/site/js/main.js @@ -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); diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js index 8449b958..3bd0fcc3 100644 --- a/lib/ace/virtual_renderer.js +++ b/lib/ace/virtual_renderer.js @@ -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