trigger redraw less often

This commit is contained in:
nightwing 2014-08-01 22:06:43 +04:00
commit 72dcd28905
2 changed files with 9 additions and 5 deletions

View file

@ -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);

View file

@ -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);