angular-ui / ui-codemirror

This directive allows you to add CodeMirror to your textarea elements.
http://angular-ui.github.io/ui-codemirror
MIT License
378 stars 193 forks source link

Code folding failed ... #72

Open klwemu opened 9 years ago

klwemu commented 9 years ago

CodeMirror offers nice CodeFolding. Demo: http://codemirror.net/2/demo/folding.html

With ui-cm Directive it does not work. I use something like this ....

        var foldFunc = CodeMirror.newFoldFunction(CodeMirror.tagRangeFinder);
        _cm.on("gutterClick", function (e) {
            foldFunc(_cm, _cm.getCursor().line);
        });

But when clicked into the guttter zone, the tagRangeFinder runs in an endless loop. The only one difference I found to the original example, ui-cm return a different object.

klwemu commented 9 years ago

Look completly same, but ....

First image is from CM Demo Page (http://codemirror.net/2/demo/folding.html) image

2nd Img is with ui-cm ... (represents line 33 in ui-codemirror.js) image

The nearly same textarea object creates 2 different CM objects.

klwemu commented 9 years ago

DOES NOBODY NEED/USE CODE FOLDING?