From fa2dd94e5c150485bec5c2525bc3fa13714c7ef8 Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Wed, 6 Oct 2010 15:42:01 +0200 Subject: [PATCH] fix update lines --- src/ace/VirtualRenderer.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/ace/VirtualRenderer.js b/src/ace/VirtualRenderer.js index 3c1fedf4..a76f9b12 100644 --- a/src/ace/VirtualRenderer.js +++ b/src/ace/VirtualRenderer.js @@ -116,7 +116,7 @@ var VirtualRenderer = function(container, theme) { /** * Triggers partial update of the text layer */ - this.updateLines = function(firstRow, lastRow) { + this.updateLines = function(firstRow, lastRow) { if (!this.$changedLines) { this.$changedLines = { firstRow: firstRow, @@ -130,6 +130,8 @@ var VirtualRenderer = function(container, theme) { if (this.$changedLines.lastRow < lastRow) this.$changedLines.lastRow = lastRow; } + if (this.$changedLines.lastRow === undefined) + this.$changedLines.lastRow = Infinity; this.$loop.schedule(this.CHANGE_LINES); }; @@ -371,7 +373,10 @@ var VirtualRenderer = function(container, theme) { this.$updateLines = function() { var firstRow = this.$changedLines.firstRow; var lastRow = this.$changedLines.lastRow; - this.$changedLines = null; + this.$changedLines = { + firstRow: 0, + lastRow: Infinity + }; var layerConfig = this.layerConfig; @@ -383,8 +388,11 @@ var VirtualRenderer = function(container, theme) { if (lastRow < layerConfig.firstRow) { return; } // if the last row is unknown -> redraw everything - if (lastRow === undefined) - return this.$textLayer.update(layerConfig); + if (lastRow === Infinity) { + this.$gutterLayer.update(layerConfig); + this.$textLayer.update(layerConfig); + return; + } // else update only the changed rows this.$textLayer.updateLines(layerConfig, firstRow, lastRow);