fix caching of foldWidgets

This commit is contained in:
nightwing 2011-12-01 23:19:42 +04:00
commit d9f3eff921
3 changed files with 5 additions and 3 deletions

View file

@ -129,7 +129,8 @@ var Gutter = function(parentEl) {
if (foldWidgets) {
var c = foldWidgets[i];
if (!c)
// check if cached value is invalidated and we need to recompute
if (c == null)
c = foldWidgets[i] = this.session.getFoldWidget(i);
if (c)
html.push(

View file

@ -48,6 +48,7 @@ var FoldMode = exports.FoldMode = function() {};
this.foldingStartMarker = null;
this.foldingStopMarker = null;
// must return "" if there's no fold, to enable caching
this.getFoldWidget = function(session, row) {
if (this.foldingStartMarker) {
if (this.foldingStopMarker)

View file

@ -66,13 +66,13 @@ oop.inherits(FoldMode, BaseFoldMode);
var fold = tags[0];
if (!fold || this.voidElements[fold])
return;
return "";
if (fold.charAt(0) == "/")
return "end";
if (tags.indexOf("/" + fold) !== -1)
return;
return "";
return "start";
};