fix caching of foldWidgets
This commit is contained in:
parent
a82c478d6d
commit
d9f3eff921
3 changed files with 5 additions and 3 deletions
|
|
@ -129,7 +129,8 @@ var Gutter = function(parentEl) {
|
||||||
|
|
||||||
if (foldWidgets) {
|
if (foldWidgets) {
|
||||||
var c = foldWidgets[i];
|
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);
|
c = foldWidgets[i] = this.session.getFoldWidget(i);
|
||||||
if (c)
|
if (c)
|
||||||
html.push(
|
html.push(
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ var FoldMode = exports.FoldMode = function() {};
|
||||||
this.foldingStartMarker = null;
|
this.foldingStartMarker = null;
|
||||||
this.foldingStopMarker = null;
|
this.foldingStopMarker = null;
|
||||||
|
|
||||||
|
// must return "" if there's no fold, to enable caching
|
||||||
this.getFoldWidget = function(session, row) {
|
this.getFoldWidget = function(session, row) {
|
||||||
if (this.foldingStartMarker) {
|
if (this.foldingStartMarker) {
|
||||||
if (this.foldingStopMarker)
|
if (this.foldingStopMarker)
|
||||||
|
|
|
||||||
|
|
@ -66,13 +66,13 @@ oop.inherits(FoldMode, BaseFoldMode);
|
||||||
var fold = tags[0];
|
var fold = tags[0];
|
||||||
|
|
||||||
if (!fold || this.voidElements[fold])
|
if (!fold || this.voidElements[fold])
|
||||||
return;
|
return "";
|
||||||
|
|
||||||
if (fold.charAt(0) == "/")
|
if (fold.charAt(0) == "/")
|
||||||
return "end";
|
return "end";
|
||||||
|
|
||||||
if (tags.indexOf("/" + fold) !== -1)
|
if (tags.indexOf("/" + fold) !== -1)
|
||||||
return;
|
return "";
|
||||||
|
|
||||||
return "start";
|
return "start";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue