diff --git a/editor.php b/editor.php index a20e3d3..182f25b 100644 --- a/editor.php +++ b/editor.php @@ -132,9 +132,9 @@ function createNewCMInstance(num) { mode: "application/x-httpd-php", lineNumbers: true, lineWrapping: top.ICEcoder.lineWrapping, - indentUnit: top.ICEcoder.tabWidth, - tabSize: top.ICEcoder.tabWidth, - indentWithTabs: true, + indentWithTabs: top.ICEcoder.indentWithTabs, + indentUnit: top.ICEcoder.indentSize, + tabSize: top.ICEcoder.indentSize, electricChars: false, autoCloseTags: true, highlightSelectionMatches: true, diff --git a/index.php b/index.php index b4ea254..bcee44a 100644 --- a/index.php +++ b/index.php @@ -60,8 +60,10 @@ if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) { echo $ICEcoder["openLastFiles"] ? 'true' : 'false'; echo ';top.ICEcoder.lineWrapping = '; echo $ICEcoder["lineWrapping"] ? 'true' : 'false'; - echo ';top.ICEcoder.tabWidth = '; - echo $ICEcoder["tabWidth"]; + echo ';top.ICEcoder.indentWithTabs = '; + echo $ICEcoder["indentWithTabs"] ? 'true' : 'false'; + echo ';top.ICEcoder.indentSize = '; + echo $ICEcoder["indentSize"]; ?>;ICEcoder.init()" onResize="ICEcoder.setLayout()" onKeyDown="return ICEcoder.interceptKeys('coder',event);" onKeyUp="parent.ICEcoder.resetKeys(event);">
diff --git a/lib/config-template.php b/lib/config-template.php index 0944408..5d28f3b 100644 --- a/lib/config-template.php +++ b/lib/config-template.php @@ -26,7 +26,8 @@ $ICEcoder = array( ), "theme" => "default", "lineWrapping" => true, -"tabWidth" => 4, +"indentWithTabs" => true, +"indentSize" => 4, "previousFiles" => "", "last10Files" => "" ); diff --git a/lib/ice-coder.js b/lib/ice-coder.js index cd51450..b658fdc 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -1431,7 +1431,7 @@ var ICEcoder = { }, // Update the settings used when we make a change to them - useNewSettings: function(themeURL,codeAssist,lockedNav,visibleTabs,lineWrapping,tabWidth,refreshFM) { + useNewSettings: function(themeURL,codeAssist,lockedNav,visibleTabs,lineWrapping,indentWithTabs,indentSize,refreshFM) { var styleNode, strCSS, cMCSS, activeLineBG; // Add new stylesheet for selected theme @@ -1461,11 +1461,13 @@ var ICEcoder = { cMCSS[strCSS][2].style.cssText = "background: " + activeLineBG + " !important"; top.ICEcoder.lineWrapping = lineWrapping; - top.ICEcoder.tabWidth = tabWidth; + top.ICEcoder.indentWithTabs = indentWithTabs; + top.ICEcoder.indentSize = indentSize; for (var i=0;i - tab width chars
- "> + indent type
+ +
+ + + indent size chars
+ ">


@@ -178,8 +186,8 @@ function findSequence(goal) { var editor = CodeMirror.fromTextArea(document.getElementById("code"), { lineNumbers: true, readOnly: "nocursor", - indentUnit: top.ICEcoder.tabWidth, - tabSize: top.ICEcoder.tabWidth, + indentUnit: top.ICEcoder.indentSize, + tabSize: top.ICEcoder.indentSize, mode: "javascript", theme: "" }); @@ -191,10 +199,10 @@ function selectTheme() { editor.setOption("theme", theme); } -function changeTabWidth() { - var tabWidth = document.getElementById("tabWidth").value; - editor.setOption("indentUnit", tabWidth); - editor.setOption("tabSize", tabWidth); +function changeIndentSize() { + var indentSize = document.getElementById("indentSize").value; + editor.setOption("indentUnit", indentSize); + editor.setOption("tabSize", indentSize); } var showButton = function() { diff --git a/lib/settings.php b/lib/settings.php index 9d3a630..83b6d4a 100644 --- a/lib/settings.php +++ b/lib/settings.php @@ -84,9 +84,10 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset $ICEcoder["plugins"] = 'array('.PHP_EOL.' array('.PHP_EOL.' '.str_replace('====================','),'.PHP_EOL.' array(',$_POST['plugins']).'))'; $ICEcoder["theme"] = strClean($_POST['theme']); $ICEcoder["lineWrapping"] = strClean($_POST['lineWrapping']); - $ICEcoder["tabWidth"] = numClean($_POST['tabWidth']); + $ICEcoder["indentWithTabs"] = strClean($_POST['indentWithTabs']); + $ICEcoder["indentSize"] = numClean($_POST['indentSize']); - $settingsArray = array("root","checkUpdates","openLastFiles","findFilesExclude","codeAssist","visibleTabs","lockedNav","accountPassword","bannedFiles","bannedPaths","allowedIPs","plugins","theme","lineWrapping","tabWidth"); + $settingsArray = array("root","checkUpdates","openLastFiles","findFilesExclude","codeAssist","visibleTabs","lockedNav","accountPassword","bannedFiles","bannedPaths","allowedIPs","plugins","theme","lineWrapping","indentWithTabs","indentSize"); $settingsNew = ""; for ($i=0;$i '; @@ -115,7 +116,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset // Do we need a file manager refresh? $refreshFM = $_POST['changedFileSettings']=="true" ? "true" : "false"; // With all that worked out, we can now hide the settings screen and apply the new settings - echo ""; + echo ""; } // Establish our user level