fix background tokenizer

This commit is contained in:
Fabian Jakobs 2010-04-16 15:46:19 +02:00
commit b1a902b196
2 changed files with 7 additions and 7 deletions

View file

@ -22,8 +22,7 @@ ace.BackgroundTokenizer = function(tokenizer) {
var state = self.currentLine == 0 ? "start"
: self.lines[self.currentLine - 1].state;
self.lines[self.currentLine] = self.tokenizer.getLineTokens(line,
state);
self.lines[self.currentLine] = self.tokenizer.getLineTokens(line, state);
// only check every 30 lines
processedLines += 1;
@ -69,11 +68,12 @@ ace.BackgroundTokenizer.prototype.fireUpdateEvent = function(firstRow, lastRow)
ace.BackgroundTokenizer.prototype.start = function(startRow) {
this.currentLine = Math.min(startRow || 0, this.currentLine,
this.textLines.length);
this.lines.splice(startRow, this.lines.length);
this.lines.splice(this.currentLine, this.lines.length);
if (!this.running) {
this.running = true;
setTimeout(this._worker, 50);
clearTimeout(this.running);
this.running = setTimeout(this._worker, 50);
}
};

View file

@ -129,8 +129,8 @@ ace.Editor.prototype.onBlur = function() {
ace.Editor.prototype.onDocumentChange = function(e) {
var data = e.data;
this.bgTokenizer.start(data.startRow);
this.renderer.updateLines(data.startRow, data.endRow);
this.bgTokenizer.start(data.firstRow);
this.renderer.updateLines(data.firstRow, data.endRow);
};
ace.Editor.prototype.onTokenizerUpdate = function(e) {