src/extensions/default/CodeFolding/main.js
function collapseCurrent() {
        var editor = EditorManager.getFocusedEditor();
        if (!editor) {
            return;
        }
        var cm = editor._codeMirror;
        var cursor = editor.getCursorPos(), i;
        // Move cursor up until a collapsible line is found
        for (i = cursor.line; i >= 0; i--) {
            if (cm.foldCode(i)) {
                editor.setCursorPos(i);
                return;
            }
        }
    }
function collapseCurrent() {
        var editor = EditorManager.getFocusedEditor();
        if (!editor) {
            return;
        }
        var cm = editor._codeMirror;
        var cursor = editor.getCursorPos(), i;
        // Move cursor up until a collapsible line is found
        for (i = cursor.line; i >= 0; i--) {
            if (cm.foldCode(i)) {
                editor.setCursorPos(i);
                return;
            }
        }
    }
function collapseCurrent ( ) { var editor = EditorManager . getFocusedEditor ( ) ; if ( ! editor ) { return ; } var cm = editor . _codeMirror ; var cursor = editor . getCursorPos ( ) , i ; // Move cursor up until a collapsible line is found for ( i = cursor . line ; i >= 0 ; i -- ) { if ( cm . foldCode ( i ) ) { editor . setCursorPos ( i ) ; return ; } } }
Collapses the code region nearest the current cursor position.
Nearest is found by searching from the current line and moving up the document until an
opening code-folding region is found.
Collapses the code region nearest the current cursor position . Nearest is found by searching from the current line and moving up the document until an opening code - folding region is found .