diff --git a/lib/ace/mode/folding/fold_mode.js b/lib/ace/mode/folding/fold_mode.js index 5180ec73..e412f5c9 100644 --- a/lib/ace/mode/folding/fold_mode.js +++ b/lib/ace/mode/folding/fold_mode.js @@ -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); });