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)
|
if(row > lastRow)
|
||||||
break;
|
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
|
// Get the tokens per line as there might be some lines in between
|
||||||
// beeing folded.
|
// beeing folded.
|
||||||
// OPTIMIZE: If there is a long block of unfolded lines, just make
|
// 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);
|
var tokens = this.session.getTokens(row, row);
|
||||||
if (tokens.length == 1)
|
if (tokens.length == 1)
|
||||||
this.$renderLine(html, row, tokens[0].tokens);
|
this.$renderLine(html, row, tokens[0].tokens);
|
||||||
html.push("</div>")
|
html.push("</div>");
|
||||||
|
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
@ -353,11 +353,11 @@ var Text = function(parentEl) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
screenColumn += 1;
|
screenColumn += 1;
|
||||||
return "<span class='ace_cjk' style='width:"
|
return "<span class='ace_cjk' style='width:" +
|
||||||
+ (self.config.characterWidth * 2)
|
(self.config.characterWidth * 2) +
|
||||||
+ "px'>" + c + "</span>";
|
"px'>" + c + "</span>";
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
var output = value.replace(replaceReg, replaceFunc);
|
var output = value.replace(replaceReg, replaceFunc);
|
||||||
|
|
||||||
|
|
@ -369,7 +369,7 @@ var Text = function(parentEl) {
|
||||||
stringBuilder.push(output);
|
stringBuilder.push(output);
|
||||||
}
|
}
|
||||||
return value.length;
|
return value.length;
|
||||||
}
|
};
|
||||||
|
|
||||||
this.$renderLineCore = function(stringBuilder, lastRow, tokens, splits) {
|
this.$renderLineCore = function(stringBuilder, lastRow, tokens, splits) {
|
||||||
var chars = 0,
|
var chars = 0,
|
||||||
|
|
@ -419,7 +419,7 @@ var Text = function(parentEl) {
|
||||||
addToken(token, value);
|
addToken(token, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
if (this.showInvisibles) {
|
if (this.showInvisibles) {
|
||||||
if (lastRow !== this.session.getLength() - 1) {
|
if (lastRow !== this.session.getLength() - 1) {
|
||||||
|
|
@ -429,16 +429,16 @@ var Text = function(parentEl) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stringBuilder.push("</div>");
|
stringBuilder.push("</div>");
|
||||||
}
|
};
|
||||||
|
|
||||||
this.$renderLine = function(stringBuilder, row, tokens) {
|
this.$renderLine = function(stringBuilder, row, tokens) {
|
||||||
// Check if the line to render is folded or not. If not, things are
|
// Check if the line to render is folded or not. If not, things are
|
||||||
// simple, otherwise, we need to fake some things...
|
// simple, otherwise, we need to fake some things...
|
||||||
if (!this.session.isRowFolded(row)) {
|
if (!this.session.isRowFolded(row)) {
|
||||||
var splits = this.session.getRowSplitData(row);
|
var splits = this.session.getRowSplitData(row);
|
||||||
this.$renderLineCore(stringBuilder, row, tokens, splits)
|
this.$renderLineCore(stringBuilder, row, tokens, splits);
|
||||||
} else {
|
} 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) {
|
function addTokens(tokens, from, to) {
|
||||||
var idx = 0, col = 0;
|
var idx = 0, col = 0;
|
||||||
while ((col + tokens[idx].value.length) < from) {
|
while ((col + tokens[idx].value.length) < from) {
|
||||||
col += tokens[idx].value.length
|
col += tokens[idx].value.length;
|
||||||
idx++
|
idx++;
|
||||||
|
|
||||||
if (idx == tokens.length) {
|
if (idx == tokens.length) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -470,7 +470,7 @@ var Text = function(parentEl) {
|
||||||
});
|
});
|
||||||
|
|
||||||
col = from + value.length;
|
col = from + value.length;
|
||||||
idx += 1
|
idx += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (col < to) {
|
while (col < to) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue