fix update bug after removing lines
This commit is contained in:
parent
3c2bd0f76e
commit
d14c7e6a58
3 changed files with 8 additions and 6 deletions
|
|
@ -513,9 +513,7 @@ var Document = function(text, mode) {
|
|||
|
||||
this.$remove(range, fromUndo);
|
||||
|
||||
this.fireChangeEvent(range.start.row,
|
||||
!range.isMultiLine() ? range.start.row
|
||||
: undefined);
|
||||
this.fireChangeEvent(range.start.row, range.isMultiLine() ? undefined : range.start.row);
|
||||
|
||||
return range.start;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ var RenderLoop = function(onRender) {
|
|||
(function() {
|
||||
|
||||
this.schedule = function(change) {
|
||||
// this.onRender(change);
|
||||
// return;
|
||||
this.changes = this.changes | change;
|
||||
if (!this.pending) {
|
||||
this.pending = true;
|
||||
|
|
|
|||
|
|
@ -120,6 +120,9 @@ var VirtualRenderer = function(container, theme) {
|
|||
* Triggers partial update of the text layer
|
||||
*/
|
||||
this.updateLines = function(firstRow, lastRow) {
|
||||
if (lastRow === undefined)
|
||||
lastRow = Infinity;
|
||||
|
||||
if (!this.$changedLines) {
|
||||
this.$changedLines = {
|
||||
firstRow: firstRow,
|
||||
|
|
@ -133,8 +136,6 @@ 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);
|
||||
};
|
||||
|
|
@ -186,6 +187,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
};
|
||||
|
||||
this.setTokenizer = function(tokenizer) {
|
||||
this.$tokenizer = tokenizer;
|
||||
this.$textLayer.setTokenizer(tokenizer);
|
||||
this.$loop.schedule(this.CHANGE_TEXT);
|
||||
};
|
||||
|
|
@ -301,7 +303,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
};
|
||||
|
||||
this.$renderChanges = function(changes) {
|
||||
if (!changes)
|
||||
if (!changes || !this.doc || !this.$tokenizer)
|
||||
return;
|
||||
|
||||
// text, scrolling and resize changes can cause the view port size to change
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue