src/extensions/default/CodeFolding/foldhelpers/foldgutter.js
function init() {
        CodeMirror.defineOption("foldGutter", false, function (cm, val, old) {
            if (old && old !== CodeMirror.Init) {
                cm.clearGutter(cm.state.foldGutter.options.gutter);
                cm.state.foldGutter = null;
                cm.off("gutterClick", old.onGutterClick);
                cm.off("change", onChange);
                cm.off("viewportChange", onViewportChange);
                cm.off("cursorActivity", onCursorActivity);

                cm.off("fold", onFold);
                cm.off("unfold", onUnFold);
                cm.off("swapDoc", updateInViewport);
            }
            if (val) {
                cm.state.foldGutter = new State(parseOptions(val));
                updateInViewport(cm);
                cm.on("gutterClick", val.onGutterClick);
                cm.on("change", onChange);
                cm.on("viewportChange", onViewportChange);
                cm.on("cursorActivity", onCursorActivity);
                cm.on("fold", onFold);
                cm.on("unfold", onUnFold);
                cm.on("swapDoc", updateInViewport);
            }
        });
    }
function init() {
        CodeMirror.defineOption("foldGutter", false, function (cm, val, old) {
            if (old && old !== CodeMirror.Init) {
                cm.clearGutter(cm.state.foldGutter.options.gutter);
                cm.state.foldGutter = null;
                cm.off("gutterClick", old.onGutterClick);
                cm.off("change", onChange);
                cm.off("viewportChange", onViewportChange);
                cm.off("cursorActivity", onCursorActivity);

                cm.off("fold", onFold);
                cm.off("unfold", onUnFold);
                cm.off("swapDoc", updateInViewport);
            }
            if (val) {
                cm.state.foldGutter = new State(parseOptions(val));
                updateInViewport(cm);
                cm.on("gutterClick", val.onGutterClick);
                cm.on("change", onChange);
                cm.on("viewportChange", onViewportChange);
                cm.on("cursorActivity", onCursorActivity);
                cm.on("fold", onFold);
                cm.on("unfold", onUnFold);
                cm.on("swapDoc", updateInViewport);
            }
        });
    }
function init ( ) { CodeMirror . defineOption ( "foldGutter" , false , function ( cm , val , old ) { if ( old && old !== CodeMirror . Init ) { cm . clearGutter ( cm . state . foldGutter . options . gutter ) ; cm . state . foldGutter = null ; cm . off ( "gutterClick" , old . onGutterClick ) ; cm . off ( "change" , onChange ) ; cm . off ( "viewportChange" , onViewportChange ) ; cm . off ( "cursorActivity" , onCursorActivity ) ; cm . off ( "fold" , onFold ) ; cm . off ( "unfold" , onUnFold ) ; cm . off ( "swapDoc" , updateInViewport ) ; } if ( val ) { cm . state . foldGutter = new State ( parseOptions ( val ) ) ; updateInViewport ( cm ) ; cm . on ( "gutterClick" , val . onGutterClick ) ; cm . on ( "change" , onChange ) ; cm . on ( "viewportChange" , onViewportChange ) ; cm . on ( "cursorActivity" , onCursorActivity ) ; cm . on ( "fold" , onFold ) ; cm . on ( "unfold" , onUnFold ) ; cm . on ( "swapDoc" , updateInViewport ) ; } } ) ; }
Initialises the fold gutter and registers event handlers for changes to document, viewport
and user interactions.
Initialises the fold gutter and registers event handlers for changes to document viewport and user interactions .