small optimization + namechange for getNextFold->getNextFoldLine
This commit is contained in:
parent
e8bfde6e5d
commit
70201ad6a7
4 changed files with 12 additions and 12 deletions
|
|
@ -1457,7 +1457,7 @@ var EditSession = function(text, mode) {
|
|||
// clamp row before clamping column, for selection on last line
|
||||
var maxRow = this.getLength() - 1;
|
||||
|
||||
var foldLine = this.getNextFold(docRow);
|
||||
var foldLine = this.getNextFoldLine(docRow);
|
||||
var foldStart = foldLine ? foldLine.start.row : Infinity;
|
||||
|
||||
while (row <= screenRow) {
|
||||
|
|
@ -1469,7 +1469,7 @@ var EditSession = function(text, mode) {
|
|||
docRow++;
|
||||
if (docRow > foldStart) {
|
||||
docRow = foldLine.end.row+1;
|
||||
foldLine = this.getNextFold(docRow);
|
||||
foldLine = this.getNextFoldLine(docRow, foldLine);
|
||||
foldStart = foldLine ? foldLine.start.row : Infinity;
|
||||
}
|
||||
}
|
||||
|
|
@ -1579,7 +1579,7 @@ var EditSession = function(text, mode) {
|
|||
}
|
||||
var doCache = !rowCache.length || i == rowCache.length;
|
||||
|
||||
var foldLine = this.getNextFold(row);
|
||||
var foldLine = this.getNextFoldLine(row);
|
||||
var foldStart = foldLine ?foldLine.start.row :Infinity;
|
||||
|
||||
while (row < docRow) {
|
||||
|
|
@ -1587,7 +1587,7 @@ var EditSession = function(text, mode) {
|
|||
rowEnd = foldLine.end.row + 1;
|
||||
if (rowEnd > docRow)
|
||||
break;
|
||||
foldLine = this.getNextFold(rowEnd);
|
||||
foldLine = this.getNextFoldLine(rowEnd, foldLine);
|
||||
foldStart = foldLine ?foldLine.start.row :Infinity;
|
||||
}
|
||||
else {
|
||||
|
|
@ -1713,4 +1713,4 @@ var EditSession = function(text, mode) {
|
|||
require("ace/edit_session/folding").Folding.call(EditSession.prototype);
|
||||
|
||||
exports.EditSession = EditSession;
|
||||
});
|
||||
});
|
||||
|
|
@ -183,7 +183,7 @@ function Folding() {
|
|||
}
|
||||
|
||||
// returns the fold which starts after or contains docRow
|
||||
this.getNextFold = function(docRow, startFoldLine) {
|
||||
this.getNextFoldLine = function(docRow, startFoldLine) {
|
||||
var foldData = this.$foldData, ans;
|
||||
var i = 0;
|
||||
if (startFoldLine)
|
||||
|
|
|
|||
|
|
@ -103,13 +103,13 @@ var Gutter = function(parentEl) {
|
|||
var html = [];
|
||||
var i = config.firstRow;
|
||||
var lastRow = config.lastRow;
|
||||
var fold = this.session.getNextFold(i);
|
||||
var fold = this.session.getNextFoldLine(i);
|
||||
var foldStart = fold ? fold.start.row : Infinity;
|
||||
|
||||
while (true) {
|
||||
if(i > foldStart) {
|
||||
i = fold.end.row + 1;
|
||||
fold = this.session.getNextFold(i);
|
||||
fold = this.session.getNextFoldLine(i, fold);
|
||||
foldStart = fold ?fold.start.row :Infinity;
|
||||
}
|
||||
if(i > lastRow)
|
||||
|
|
|
|||
|
|
@ -260,13 +260,13 @@ var Text = function(parentEl) {
|
|||
this.$renderLinesFragment = function(config, firstRow, lastRow) {
|
||||
var fragment = this.element.ownerDocument.createDocumentFragment(),
|
||||
row = firstRow,
|
||||
fold = this.session.getNextFold(row),
|
||||
fold = this.session.getNextFoldLine(row),
|
||||
foldStart = fold ?fold.start.row :Infinity;
|
||||
|
||||
while (true) {
|
||||
if(row > foldStart) {
|
||||
row = fold.end.row+1;
|
||||
fold = this.session.getNextFold(row);
|
||||
fold = this.session.getNextFoldLine(row, fold);
|
||||
foldStart = fold ?fold.start.row :Infinity;
|
||||
}
|
||||
if(row > lastRow)
|
||||
|
|
@ -307,13 +307,13 @@ var Text = function(parentEl) {
|
|||
var firstRow = config.firstRow, lastRow = config.lastRow;
|
||||
|
||||
var row = firstRow,
|
||||
fold = this.session.getNextFold(row),
|
||||
fold = this.session.getNextFoldLine(row),
|
||||
foldStart = fold ?fold.start.row :Infinity;
|
||||
|
||||
while (true) {
|
||||
if(row > foldStart) {
|
||||
row = fold.end.row+1;
|
||||
fold = this.session.getNextFold(row);
|
||||
fold = this.session.getNextFoldLine(row, fold);
|
||||
foldStart = fold ?fold.start.row :Infinity;
|
||||
}
|
||||
if(row > lastRow)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue