Merge pull request #909 from ajaxorg/rowCache

fix rowcache not working for row 1
This commit is contained in:
Lennart Kats 2012-09-05 01:37:47 -07:00
commit e4c8681bee
2 changed files with 40 additions and 14 deletions

View file

@ -230,14 +230,14 @@ var EditSession = function(text, mode) {
*
*
**/
this.$resetRowCache = function(docRrow) {
if (!docRrow) {
this.$resetRowCache = function(docRow) {
if (!docRow) {
this.$docRowCache = [];
this.$screenRowCache = [];
return;
}
var i = this.$getRowCacheIndex(this.$docRowCache, docRrow) + 1;
var i = this.$getRowCacheIndex(this.$docRowCache, docRow) + 1;
var l = this.$docRowCache.length;
this.$docRowCache.splice(i, l);
this.$screenRowCache.splice(i, l);
@ -1868,10 +1868,8 @@ var EditSession = function(text, mode) {
};
this.$updateRowLengthCache = function(firstRow, lastRow, b) {
//console.log(firstRow, lastRow, b)
this.$rowLengthCache[firstRow] = null;
this.$rowLengthCache[lastRow] = null;
//console.log(this.$rowLengthCache)
};
/** internal, hide
@ -2251,7 +2249,7 @@ var EditSession = function(text, mode) {
var docRow = this.$docRowCache[i];
var doCache = screenRow > row || (screenRow == row && i == rowCache.length - 1);
} else {
var doCache = true;
var doCache = i != 0 || !rowCache.length;
}
var maxRow = this.getLength() - 1;
@ -2356,7 +2354,7 @@ var EditSession = function(text, mode) {
var screenRow = this.$screenRowCache[i];
var doCache = docRow > row || (docRow == row && i == rowCache.length - 1);
} else {
var doCache = true;
var doCache = i != 0 || !rowCache.length;
}
var foldLine = this.getNextFoldLine(row);