fix #280 and cleanup some code
This commit is contained in:
parent
eb02e51e97
commit
f164a557c5
1 changed files with 14 additions and 14 deletions
|
|
@ -306,7 +306,7 @@ var Text = function(parentEl) {
|
|||
if(row > lastRow)
|
||||
break;
|
||||
|
||||
html.push("<div class='ace_line'>")
|
||||
html.push("<div class='ace_line'>");
|
||||
// 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
|
||||
|
|
@ -314,7 +314,7 @@ var Text = function(parentEl) {
|
|||
var tokens = this.session.getTokens(row, row);
|
||||
if (tokens.length == 1)
|
||||
this.$renderLine(html, row, tokens[0].tokens);
|
||||
html.push("</div>")
|
||||
html.push("</div>");
|
||||
|
||||
row++;
|
||||
}
|
||||
|
|
@ -353,11 +353,11 @@ var Text = function(parentEl) {
|
|||
}
|
||||
} else {
|
||||
screenColumn += 1;
|
||||
return "<span class='ace_cjk' style='width:"
|
||||
+ (self.config.characterWidth * 2)
|
||||
+ "px'>" + c + "</span>";
|
||||
return "<span class='ace_cjk' style='width:" +
|
||||
(self.config.characterWidth * 2) +
|
||||
"px'>" + c + "</span>";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var output = value.replace(replaceReg, replaceFunc);
|
||||
|
||||
|
|
@ -369,7 +369,7 @@ var Text = function(parentEl) {
|
|||
stringBuilder.push(output);
|
||||
}
|
||||
return value.length;
|
||||
}
|
||||
};
|
||||
|
||||
this.$renderLineCore = function(stringBuilder, lastRow, tokens, splits) {
|
||||
var chars = 0,
|
||||
|
|
@ -419,7 +419,7 @@ var Text = function(parentEl) {
|
|||
addToken(token, value);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (this.showInvisibles) {
|
||||
if (lastRow !== this.session.getLength() - 1) {
|
||||
|
|
@ -429,16 +429,16 @@ var Text = function(parentEl) {
|
|||
}
|
||||
}
|
||||
stringBuilder.push("</div>");
|
||||
}
|
||||
};
|
||||
|
||||
this.$renderLine = function(stringBuilder, row, tokens) {
|
||||
// Check if the line to render is folded or not. If not, things are
|
||||
// simple, otherwise, we need to fake some things...
|
||||
if (!this.session.isRowFolded(row)) {
|
||||
var splits = this.session.getRowSplitData(row);
|
||||
this.$renderLineCore(stringBuilder, row, tokens, splits)
|
||||
this.$renderLineCore(stringBuilder, row, tokens, splits);
|
||||
} else {
|
||||
this.$renderFoldLine(stringBuilder, row, tokens, splits);
|
||||
this.$renderFoldLine(stringBuilder, row, tokens);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -450,8 +450,8 @@ var Text = function(parentEl) {
|
|||
function addTokens(tokens, from, to) {
|
||||
var idx = 0, col = 0;
|
||||
while ((col + tokens[idx].value.length) < from) {
|
||||
col += tokens[idx].value.length
|
||||
idx++
|
||||
col += tokens[idx].value.length;
|
||||
idx++;
|
||||
|
||||
if (idx == tokens.length) {
|
||||
return;
|
||||
|
|
@ -470,7 +470,7 @@ var Text = function(parentEl) {
|
|||
});
|
||||
|
||||
col = from + value.length;
|
||||
idx += 1
|
||||
idx += 1;
|
||||
}
|
||||
|
||||
while (col < to) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue