Merge pull request #1140 from ajaxorg/hotfix/renderer

Fix bug in rowCache
This commit is contained in:
Mostafa Eweda 2012-12-13 07:15:48 -08:00
commit f3d0096050
4 changed files with 52 additions and 13 deletions

View file

@ -244,7 +244,7 @@ var EditSession = function(text, mode) {
return mid;
}
return low && low -1;
return low -1;
};
this.resetCaches = function() {
@ -2164,12 +2164,13 @@ var EditSession = function(text, mode) {
var rowCache = this.$screenRowCache;
var i = this.$getRowCacheIndex(rowCache, screenRow);
if (0 < i && i < rowCache.length) {
var l = rowCache.length;
if (l && i >= 0) {
var row = rowCache[i];
var docRow = this.$docRowCache[i];
var doCache = screenRow > row || (screenRow == row && i == rowCache.length - 1);
var doCache = screenRow > rowCache[l - 1];
} else {
var doCache = i != 0 || !rowCache.length;
var doCache = !l;
}
var maxRow = this.getLength() - 1;
@ -2189,6 +2190,7 @@ var EditSession = function(text, mode) {
foldStart = foldLine ? foldLine.start.row : Infinity;
}
}
if (doCache) {
this.$docRowCache.push(docRow);
this.$screenRowCache.push(row);
@ -2269,12 +2271,13 @@ var EditSession = function(text, mode) {
var rowCache = this.$docRowCache;
var i = this.$getRowCacheIndex(rowCache, docRow);
if (0 < i && i < rowCache.length) {
var l = rowCache.length;
if (l && i >= 0) {
var row = rowCache[i];
var screenRow = this.$screenRowCache[i];
var doCache = docRow > row || (docRow == row && i == rowCache.length - 1);
var doCache = docRow > rowCache[l - 1];
} else {
var doCache = i != 0 || !rowCache.length;
var doCache = !l;
}
var foldLine = this.getNextFoldLine(row);