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 html = [];
|
||||||
var tokens = this.session.getTokens(i, i);
|
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(""));
|
lineElement = dom.setInnerHtml(lineElement, html.join(""));
|
||||||
|
|
||||||
i = this.session.getRowFoldEnd(i);
|
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
|
// don't use setInnerHtml since we are working with an empty DIV
|
||||||
container.innerHTML = html.join("");
|
container.innerHTML = html.join("");
|
||||||
var lines = container.childNodes
|
if (this.$useLineGroups()) {
|
||||||
while(lines.length)
|
container.className = 'ace_line_group';
|
||||||
fragment.appendChild(lines[0]);
|
fragment.appendChild(container);
|
||||||
|
} else {
|
||||||
|
var lines = container.childNodes
|
||||||
|
while(lines.length)
|
||||||
|
fragment.appendChild(lines[0]);
|
||||||
|
}
|
||||||
|
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
@ -313,6 +318,9 @@ var Text = function(parentEl) {
|
||||||
if(row > lastRow)
|
if(row > lastRow)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (this.$useLineGroups())
|
||||||
|
html.push("<div class='ace_line_group'>")
|
||||||
|
|
||||||
// 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
|
||||||
|
|
@ -321,6 +329,9 @@ var Text = function(parentEl) {
|
||||||
if (tokens.length == 1)
|
if (tokens.length == 1)
|
||||||
this.$renderLine(html, row, tokens[0].tokens, false);
|
this.$renderLine(html, row, tokens[0].tokens, false);
|
||||||
|
|
||||||
|
if (this.$useLineGroups())
|
||||||
|
html.push("</div>"); // end the line group
|
||||||
|
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
this.element = dom.setInnerHtml(this.element, html.join(""));
|
this.element = dom.setInnerHtml(this.element, html.join(""));
|
||||||
|
|
@ -531,6 +542,15 @@ var Text = function(parentEl) {
|
||||||
this.$renderLineCore(stringBuilder, row, renderTokens, splits, onlyContents);
|
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() {
|
this.destroy = function() {
|
||||||
clearInterval(this.$pollSizeChangesTimer);
|
clearInterval(this.$pollSizeChangesTimer);
|
||||||
if (this.$measureNode)
|
if (this.$measureNode)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue