diff --git a/src/BackgroundTokenizer.js b/src/BackgroundTokenizer.js index d9cfe1f6..560d7a8b 100644 --- a/src/BackgroundTokenizer.js +++ b/src/BackgroundTokenizer.js @@ -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); } }; diff --git a/src/CursorLayer.js b/src/CursorLayer.js index dcf4c2a7..b47f6af4 100644 --- a/src/CursorLayer.js +++ b/src/CursorLayer.js @@ -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(); }; \ No newline at end of file diff --git a/src/Editor.js b/src/Editor.js index 496375c3..70b4ee10 100644 --- a/src/Editor.js +++ b/src/Editor.js @@ -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) { diff --git a/src/VirtualRenderer.js b/src/VirtualRenderer.js index 0c421b1c..8c92c961 100644 --- a/src/VirtualRenderer.js +++ b/src/VirtualRenderer.js @@ -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) {