From 05daab79c1afb68e14b128e51f47722441db7303 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Thu, 22 May 2014 07:05:44 +0100 Subject: [PATCH] Rename function doFold and new namespace doFold seems a better name, so renamed and rangeFinder var now foldType New namespace convention on folding, also specifying type by foldType --- lib/foldcode.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/foldcode.js b/lib/foldcode.js index 35206ad..6995a53 100644 --- a/lib/foldcode.js +++ b/lib/foldcode.js @@ -1,6 +1,7 @@ // Modified version of CodeMirror's codefold.js to show guttermarkers -CodeMirror.newFoldFunction = function(rangeFinder, widget, markOn, markOff, dontCollapse) { +CodeMirror.doFold = function(foldType, widget, markOn, markOff, dontCollapse) { + if (widget == null) widget = "\u2194"; if (typeof widget == "string") { var text = document.createTextNode(widget); @@ -25,7 +26,7 @@ CodeMirror.newFoldFunction = function(rangeFinder, widget, markOn, markOff, dont return function(cm, pos) { if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0); - var range = rangeFinder(cm, pos); + var range = CodeMirror.fold[foldType](cm, pos); foldable = range && (range.from.line != range.to.line || range.from.ch != range.to.ch) ? true : false; if (!foldable) cm.setGutterMarker(pos.line, "folds", null); if (!range) return;