From c2e92fa355390b095160072a8e714555df55d8c8 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Wed, 29 May 2013 08:57:37 +0100 Subject: [PATCH] Brace folding on applicable filetypes On both load and change we need to use braceRangeFinder or tagRangeFinder depending on filetype Also get rid of old, commented foldStyle marker CSS historical reference as we're now using that --- editor.php | 7 +++---- lib/file-control.php | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/editor.php b/editor.php index b354804..704f965 100644 --- a/editor.php +++ b/editor.php @@ -215,7 +215,7 @@ function createNewCMInstance(num) { var filename = filepath.substr(filepath.lastIndexOf("/")+1); var fileExt = filename.substr(filename.lastIndexOf(".")+1); for (var i=changeObj.from.line; i -1 ? "braceRangeFinder" : "tagRangeFinder"],null,"+","-",true)(thisCM, i); } // Update HTML edited files live if (top.ICEcoder.previewWindow.location) { @@ -261,9 +261,8 @@ function createNewCMInstance(num) { top.ICEcoder['cMActiveLine'+num] = window['cM'+num].addLineClass(0, "background", "cm-s-activeLine"); }; - // var top.ICEcoder.foldStyle = '+ %N%'; - var codeFoldTag = CodeMirror.newFoldFunction(CodeMirror.tagRangeFinder,null,"+","-",false); - var codeFoldBrace = CodeMirror.newFoldFunction(CodeMirror.braceRangeFinder,null,"+","-",false); +var codeFoldTag = CodeMirror.newFoldFunction(CodeMirror.tagRangeFinder,null,"+","-",false); +var codeFoldBrace = CodeMirror.newFoldFunction(CodeMirror.braceRangeFinder,null,"+","-",false); diff --git a/lib/file-control.php b/lib/file-control.php index 2bf9573..5320256 100644 --- a/lib/file-control.php +++ b/lib/file-control.php @@ -366,7 +366,7 @@ if (action=="load") { top.ICEcoder.nextcMInstance++; top.ICEcoder.openFileMDTs.push(''); for (var i=0; i') > -1 ? "braceRangeFinder" : "tagRangeFinder"],null,"+","-",true)(cM, i); } top.ICEcoder.loadingFile = false;