Merge pull request #864 from ajaxorg/fix/performance

Improve performance
This commit is contained in:
Mostafa Eweda 2012-08-24 07:57:03 -07:00
commit 658c5a2bb3
6 changed files with 560 additions and 15 deletions

View file

@ -131,7 +131,6 @@
.ace_gutter .ace_layer {
position: relative;
min-width: 40px;
width: auto;
text-align: right;
pointer-events: auto;

View file

@ -148,17 +148,15 @@ var Gutter = function(parentEl) {
i++;
}
if (this.session.$useWrapMode)
html.push(
"<div class='ace_gutter-cell' style='pointer-events:none;opacity:0'>",
this.session.getLength() - 1,
"</div>"
);
this.element = dom.setInnerHtml(this.element, html.join(""));
this.element.style.height = config.minHeight + "px";
var gutterWidth = this.element.offsetWidth;
if (this.session.$useWrapMode)
i = this.session.getLength();
var gutterWidth = ("" + --i).length * config.characterWidth;
var padding = this.$padding || this.$computePadding();
gutterWidth += padding.left + padding.right;
if (gutterWidth !== this.gutterWidth) {
this.gutterWidth = gutterWidth;
this._emit("changeGutterWidth", gutterWidth);

View file

@ -735,12 +735,10 @@ var VirtualRenderer = function(container, theme) {
this.$gutterLayer.update(this.layerConfig);
}
else if (changes & this.CHANGE_LINES) {
if (this.$updateLines()) {
this.$updateScrollBar();
if (this.showGutter)
this.$gutterLayer.update(this.layerConfig);
}
} else if (changes & this.CHANGE_GUTTER) {
if (this.$updateLines() || (changes & this.CHANGE_GUTTER) && this.showGutter)
this.$gutterLayer.update(this.layerConfig);
}
else if (changes & this.CHANGE_TEXT || changes & this.CHANGE_GUTTER) {
if (this.showGutter)
this.$gutterLayer.update(this.layerConfig);
}