first support for auto indent

This commit is contained in:
Fabian Jakobs 2010-04-14 19:15:52 +02:00
commit e9fe18f657
8 changed files with 129 additions and 25 deletions

View file

@ -77,14 +77,20 @@ ace.BackgroundTokenizer.prototype.stop = function() {
};
ace.BackgroundTokenizer.prototype.getTokens = function(row) {
if (this.lines[row]) {
return this.lines[row].tokens;
}
else {
return this._tokenizeRow(row).tokens;
};
ace.BackgroundTokenizer.prototype.getState = function(row) {
return this._tokenizeRow(row).state;
};
ace.BackgroundTokenizer.prototype._tokenizeRow = function(row) {
if (!this.lines[row]) {
var state = "start";
if (row > 0 && this.lines[row - 1]) {
state = this.lines[row - 1].state;
}
return this.tokenizer.getLineTokens(this.textLines[row] || "", state).tokens;
this.lines[row] = this.tokenizer.getLineTokens(this.textLines[row] || "", state);
}
return this.lines[row];
};