fix update bug after removing lines

This commit is contained in:
Fabian Jakobs 2010-11-03 11:33:48 +01:00
commit d14c7e6a58
3 changed files with 8 additions and 6 deletions

View file

@ -513,9 +513,7 @@ var Document = function(text, mode) {
this.$remove(range, fromUndo); this.$remove(range, fromUndo);
this.fireChangeEvent(range.start.row, this.fireChangeEvent(range.start.row, range.isMultiLine() ? undefined : range.start.row);
!range.isMultiLine() ? range.start.row
: undefined);
return range.start; return range.start;
}; };

View file

@ -16,6 +16,8 @@ var RenderLoop = function(onRender) {
(function() { (function() {
this.schedule = function(change) { this.schedule = function(change) {
// this.onRender(change);
// return;
this.changes = this.changes | change; this.changes = this.changes | change;
if (!this.pending) { if (!this.pending) {
this.pending = true; this.pending = true;

View file

@ -120,6 +120,9 @@ var VirtualRenderer = function(container, theme) {
* Triggers partial update of the text layer * Triggers partial update of the text layer
*/ */
this.updateLines = function(firstRow, lastRow) { this.updateLines = function(firstRow, lastRow) {
if (lastRow === undefined)
lastRow = Infinity;
if (!this.$changedLines) { if (!this.$changedLines) {
this.$changedLines = { this.$changedLines = {
firstRow: firstRow, firstRow: firstRow,
@ -133,8 +136,6 @@ var VirtualRenderer = function(container, theme) {
if (this.$changedLines.lastRow < lastRow) if (this.$changedLines.lastRow < lastRow)
this.$changedLines.lastRow = lastRow; this.$changedLines.lastRow = lastRow;
} }
if (this.$changedLines.lastRow === undefined)
this.$changedLines.lastRow = Infinity;
this.$loop.schedule(this.CHANGE_LINES); this.$loop.schedule(this.CHANGE_LINES);
}; };
@ -186,6 +187,7 @@ var VirtualRenderer = function(container, theme) {
}; };
this.setTokenizer = function(tokenizer) { this.setTokenizer = function(tokenizer) {
this.$tokenizer = tokenizer;
this.$textLayer.setTokenizer(tokenizer); this.$textLayer.setTokenizer(tokenizer);
this.$loop.schedule(this.CHANGE_TEXT); this.$loop.schedule(this.CHANGE_TEXT);
}; };
@ -301,7 +303,7 @@ var VirtualRenderer = function(container, theme) {
}; };
this.$renderChanges = function(changes) { this.$renderChanges = function(changes) {
if (!changes) if (!changes || !this.doc || !this.$tokenizer)
return; return;
// text, scrolling and resize changes can cause the view port size to change // text, scrolling and resize changes can cause the view port size to change