rewriting bound function doesn't work
This commit is contained in:
parent
25400848f2
commit
e24dab2ea1
1 changed files with 8 additions and 29 deletions
|
|
@ -48,20 +48,14 @@ var FoldMode = exports.FoldMode = function() {};
|
|||
|
||||
// must return "" if there's no fold, to enable caching
|
||||
this.getFoldWidget = function(session, foldStyle, row) {
|
||||
if (this.foldingStartMarker) {
|
||||
if (this.foldingStopMarker) {
|
||||
// rewrite getFoldWidget so the check is only performed once
|
||||
FoldMode.prototype.getFoldWidget = this.$testBoth;
|
||||
return this.$testBoth(session, foldStyle, row);
|
||||
}
|
||||
else {
|
||||
// rewrite getFoldWidget so the check is only performed once
|
||||
FoldMode.prototype.getFoldWidget = this.$testStart;
|
||||
return this.$testStart(session, foldStyle, row);
|
||||
}
|
||||
}
|
||||
else
|
||||
return "";
|
||||
var line = session.getLine(row);
|
||||
if (this.foldingStartMarker.test(line))
|
||||
return "start";
|
||||
if (foldStyle == "markbeginend"
|
||||
&& this.foldingStopMarker
|
||||
&& this.foldingStopMarker.test(line))
|
||||
return "end";
|
||||
return "";
|
||||
};
|
||||
|
||||
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||
|
|
@ -113,21 +107,6 @@ var FoldMode = exports.FoldMode = function() {};
|
|||
return Range.fromPoints(start, end);
|
||||
};
|
||||
|
||||
this.$testStart = function(session, foldStyle, row) {
|
||||
if (this.foldingStartMarker.test(session.getLine(row)))
|
||||
return "start";
|
||||
return "";
|
||||
};
|
||||
|
||||
this.$testBoth = function(session, foldStyle, row) {
|
||||
var line = session.getLine(row);
|
||||
if (this.foldingStartMarker.test(line))
|
||||
return "start";
|
||||
if (foldStyle == "markbeginend" && this.foldingStopMarker.test(line))
|
||||
return "end";
|
||||
return "";
|
||||
};
|
||||
|
||||
}).call(FoldMode.prototype);
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue