Skip to content

Commit 05daab7

Browse files
committed
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
1 parent 57a789f commit 05daab7

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/foldcode.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Modified version of CodeMirror's codefold.js to show guttermarkers
22

3-
CodeMirror.newFoldFunction = function(rangeFinder, widget, markOn, markOff, dontCollapse) {
3+
CodeMirror.doFold = function(foldType, widget, markOn, markOff, dontCollapse) {
4+
45
if (widget == null) widget = "\u2194";
56
if (typeof widget == "string") {
67
var text = document.createTextNode(widget);
@@ -25,7 +26,7 @@ CodeMirror.newFoldFunction = function(rangeFinder, widget, markOn, markOff, dont
2526

2627
return function(cm, pos) {
2728
if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0);
28-
var range = rangeFinder(cm, pos);
29+
var range = CodeMirror.fold[foldType](cm, pos);
2930
foldable = range && (range.from.line != range.to.line || range.from.ch != range.to.ch) ? true : false;
3031
if (!foldable) cm.setGutterMarker(pos.line, "folds", null);
3132
if (!range) return;

0 commit comments

Comments
 (0)