Skip to content

Commit

Permalink
fix initial highlighting in hidden editor
Browse files Browse the repository at this point in the history
  • Loading branch information
nightwing committed Jun 19, 2013
1 parent fa13f37 commit 2852638
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions doc/site/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -102,6 +100,8 @@ $(function() {
}

$(this).tab("show");
embedded_editor.resize();
editor.resize();

var state = {};
state.nav = $(this).attr("href").substr(1);
Expand Down
9 changes: 6 additions & 3 deletions lib/ace/virtual_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2852638

Please sign in to comment.