improve bgTokenizer

This commit is contained in:
nightwing 2012-05-24 22:07:27 +04:00
commit 3adcd1e5f8
10 changed files with 103 additions and 108 deletions

View file

@ -259,8 +259,8 @@ var Text = function(parentEl) {
continue;
var html = [];
var tokens = this.session.getTokens(i, i);
this.$renderLine(html, i, tokens[0].tokens, !this.$useLineGroups());
var tokens = this.session.getTokens(i);
this.$renderLine(html, i, tokens, !this.$useLineGroups());
lineElement = dom.setInnerHtml(lineElement, html.join(""));
i = this.session.getRowFoldEnd(i);
@ -321,11 +321,8 @@ var Text = function(parentEl) {
var html = [];
// Get the tokens per line as there might be some lines in between
// beeing folded.
// OPTIMIZE: If there is a long block of unfolded lines, just make
// this call once for that big block of unfolded lines.
var tokens = this.session.getTokens(row, row);
if (tokens.length == 1)
this.$renderLine(html, row, tokens[0].tokens, false);
var tokens = this.session.getTokens(row);
this.$renderLine(html, row, tokens, false);
// don't use setInnerHtml since we are working with an empty DIV
container.innerHTML = html.join("");
@ -368,11 +365,8 @@ var Text = function(parentEl) {
// Get the tokens per line as there might be some lines in between
// beeing folded.
// OPTIMIZE: If there is a long block of unfolded lines, just make
// this call once for that big block of unfolded lines.
var tokens = this.session.getTokens(row, row);
if (tokens.length == 1)
this.$renderLine(html, row, tokens[0].tokens, false);
var tokens = this.session.getTokens(row);
this.$renderLine(html, row, tokens, false);
if (this.$useLineGroups())
html.push("</div>"); // end the line group
@ -567,12 +561,11 @@ var Text = function(parentEl) {
value: placeholder
});
} else {
if (isNewRow) {
tokens = this.session.getTokens(row, row)[0].tokens;
}
if (tokens.length != 0) {
if (isNewRow)
tokens = this.session.getTokens(row);
if (tokens.length)
addTokens(tokens, lastColumn, column);
}
}
}.bind(this), foldLine.end.row, this.session.getLine(foldLine.end.row).length);