Fix bug 371: Bug when wrap mode is enabled.
This commit is contained in:
parent
a521b24d7d
commit
dda1ff922b
1 changed files with 24 additions and 4 deletions
|
|
@ -215,7 +215,7 @@ var Text = function(parentEl) {
|
|||
|
||||
var html = [];
|
||||
var tokens = this.session.getTokens(i, i);
|
||||
this.$renderLine(html, i, tokens[0].tokens, true);
|
||||
this.$renderLine(html, i, tokens[0].tokens, !this.$useLineGroups());
|
||||
lineElement = dom.setInnerHtml(lineElement, html.join(""));
|
||||
|
||||
i = this.session.getRowFoldEnd(i);
|
||||
|
|
@ -284,9 +284,14 @@ var Text = function(parentEl) {
|
|||
|
||||
// don't use setInnerHtml since we are working with an empty DIV
|
||||
container.innerHTML = html.join("");
|
||||
var lines = container.childNodes
|
||||
while(lines.length)
|
||||
fragment.appendChild(lines[0]);
|
||||
if (this.$useLineGroups()) {
|
||||
container.className = 'ace_line_group';
|
||||
fragment.appendChild(container);
|
||||
} else {
|
||||
var lines = container.childNodes
|
||||
while(lines.length)
|
||||
fragment.appendChild(lines[0]);
|
||||
}
|
||||
|
||||
row++;
|
||||
}
|
||||
|
|
@ -313,6 +318,9 @@ var Text = function(parentEl) {
|
|||
if(row > lastRow)
|
||||
break;
|
||||
|
||||
if (this.$useLineGroups())
|
||||
html.push("<div class='ace_line_group'>")
|
||||
|
||||
// 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
|
||||
|
|
@ -321,6 +329,9 @@ var Text = function(parentEl) {
|
|||
if (tokens.length == 1)
|
||||
this.$renderLine(html, row, tokens[0].tokens, false);
|
||||
|
||||
if (this.$useLineGroups())
|
||||
html.push("</div>"); // end the line group
|
||||
|
||||
row++;
|
||||
}
|
||||
this.element = dom.setInnerHtml(this.element, html.join(""));
|
||||
|
|
@ -530,6 +541,15 @@ var Text = function(parentEl) {
|
|||
var splits = this.session.$useWrapMode?this.session.$wrapData[row]:null;
|
||||
this.$renderLineCore(stringBuilder, row, renderTokens, splits, onlyContents);
|
||||
};
|
||||
|
||||
this.$useLineGroups = function() {
|
||||
// For the updateLines function to work correctly, it's important that the
|
||||
// child nodes of this.element correspond on a 1-to-1 basis to rows in the
|
||||
// document (as distinct from lines on the screen). For sessions that are
|
||||
// wrapped, this means we need to add a layer to the node hierarchy (tagged
|
||||
// with the class name ace_line_group).
|
||||
return this.session.getUseWrapMode();
|
||||
};
|
||||
|
||||
this.destroy = function() {
|
||||
clearInterval(this.$pollSizeChangesTimer);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue