mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-06 00:34:00 +01:00
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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user