trigger redraw less often
This commit is contained in:
parent
f4990b3a56
commit
72dcd28905
2 changed files with 9 additions and 5 deletions
|
|
@ -702,7 +702,7 @@ var Editor = function(renderer, session) {
|
||||||
lastRow = range.end.row;
|
lastRow = range.end.row;
|
||||||
else
|
else
|
||||||
lastRow = Infinity;
|
lastRow = Infinity;
|
||||||
this.renderer.updateLines(range.start.row, lastRow);
|
this.renderer.updateLines(range.start.row, lastRow, this.session.$useWrapMode);
|
||||||
|
|
||||||
this._signal("change", e);
|
this._signal("change", e);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.updateLines = function(firstRow, lastRow) {
|
this.updateLines = function(firstRow, lastRow, force) {
|
||||||
if (lastRow === undefined)
|
if (lastRow === undefined)
|
||||||
lastRow = Infinity;
|
lastRow = Infinity;
|
||||||
|
|
||||||
|
|
@ -279,9 +279,13 @@ var VirtualRenderer = function(container, theme) {
|
||||||
// If the change happened offscreen above us then it's possible
|
// 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
|
// that a new line wrap will affect the position of the lines on our
|
||||||
// screen so they need redrawn.
|
// screen so they need redrawn.
|
||||||
if (this.$changedLines.lastRow < this.layerConfig.firstRow)
|
// TODO: better solution is to not change scroll position when text is changed outside of visible area
|
||||||
this.$changedLines.lastRow = this.layerConfig.lastRow
|
if (this.$changedLines.lastRow < this.layerConfig.firstRow) {
|
||||||
|
if (force)
|
||||||
|
this.$changedLines.lastRow = this.layerConfig.lastRow;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (this.$changedLines.firstRow > this.layerConfig.lastRow)
|
if (this.$changedLines.firstRow > this.layerConfig.lastRow)
|
||||||
return;
|
return;
|
||||||
this.$loop.schedule(this.CHANGE_LINES);
|
this.$loop.schedule(this.CHANGE_LINES);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue