diff --git a/lib/ace/editor.js b/lib/ace/editor.js index e198ecaa..83782f06 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -702,7 +702,7 @@ var Editor = function(renderer, session) { lastRow = range.end.row; else lastRow = Infinity; - this.renderer.updateLines(range.start.row, lastRow); + this.renderer.updateLines(range.start.row, lastRow, this.session.$useWrapMode); this._signal("change", e); diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js index dfb435be..d3e26758 100644 --- a/lib/ace/virtual_renderer.js +++ b/lib/ace/virtual_renderer.js @@ -258,7 +258,7 @@ var VirtualRenderer = function(container, theme) { * * **/ - this.updateLines = function(firstRow, lastRow) { + this.updateLines = function(firstRow, lastRow, force) { if (lastRow === undefined) lastRow = Infinity; @@ -279,9 +279,13 @@ var VirtualRenderer = function(container, theme) { // If the change happened offscreen above us then it's possible // that a new line wrap will affect the position of the lines on our // screen so they need redrawn. - if (this.$changedLines.lastRow < this.layerConfig.firstRow) - this.$changedLines.lastRow = this.layerConfig.lastRow - + // TODO: better solution is to not change scroll position when text is changed outside of visible area + if (this.$changedLines.lastRow < this.layerConfig.firstRow) { + if (force) + this.$changedLines.lastRow = this.layerConfig.lastRow; + else + return; + } if (this.$changedLines.firstRow > this.layerConfig.lastRow) return; this.$loop.schedule(this.CHANGE_LINES);