fix performance issues
This commit is contained in:
parent
a9e2986121
commit
cb8d415f87
4 changed files with 13 additions and 3 deletions
|
|
@ -73,7 +73,7 @@ ace.BackgroundTokenizer.prototype.start = function(startRow) {
|
|||
|
||||
if (!this.running) {
|
||||
clearTimeout(this.running);
|
||||
this.running = setTimeout(this._worker, 50);
|
||||
this.running = setTimeout(this._worker, 200);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,16 @@ ace.CursorLayer.prototype.showCursor = function() {
|
|||
|
||||
var cursor = this.cursor;
|
||||
cursor.style.visibility = "visible";
|
||||
this.restartTimer();
|
||||
};
|
||||
|
||||
ace.CursorLayer.prototype.restartTimer = function() {
|
||||
clearInterval(this.blinkId);
|
||||
if (!this.isVisible) {
|
||||
return;
|
||||
}
|
||||
|
||||
var cursor = this.cursor;
|
||||
this.blinkId = setInterval(function() {
|
||||
cursor.style.visibility = "hidden";
|
||||
setTimeout(function() {
|
||||
|
|
@ -68,4 +77,5 @@ ace.CursorLayer.prototype.update = function(config) {
|
|||
if (this.isVisible) {
|
||||
this.element.appendChild(this.cursor);
|
||||
}
|
||||
this.restartTimer();
|
||||
};
|
||||
|
|
@ -130,7 +130,7 @@ ace.Editor.prototype.onBlur = function() {
|
|||
ace.Editor.prototype.onDocumentChange = function(e) {
|
||||
var data = e.data;
|
||||
this.bgTokenizer.start(data.firstRow);
|
||||
this.renderer.updateLines(data.firstRow, data.endRow);
|
||||
this.renderer.updateLines(data.firstRow, data.lastRow);
|
||||
};
|
||||
|
||||
ace.Editor.prototype.onTokenizerUpdate = function(e) {
|
||||
|
|
|
|||
|
|
@ -77,8 +77,8 @@ ace.VirtualRenderer.prototype.onResize = function()
|
|||
ace.VirtualRenderer.prototype.updateLines = function(firstRow, lastRow) {
|
||||
var layerConfig = this.layerConfig;
|
||||
|
||||
// if the first row is below the viewport -> ignore it
|
||||
if (firstRow > layerConfig.lastRow + 1) { return; }
|
||||
if (lastRow < layerConfig.firstRow) { return; }
|
||||
|
||||
// if the last row is unknow -> redraw everything
|
||||
if (lastRow === undefined) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue