diff --git a/app/src/processing/app/EditorTab.java b/app/src/processing/app/EditorTab.java index c2fdbb9b464..eab701d80a0 100644 --- a/app/src/processing/app/EditorTab.java +++ b/app/src/processing/app/EditorTab.java @@ -147,6 +147,8 @@ private SketchTextArea createTextArea(RSyntaxDocument document) textArea.setMarkOccurrences(PreferencesData.getBoolean("editor.advanced")); textArea.setMarginLineEnabled(false); textArea.setCodeFoldingEnabled(PreferencesData.getBoolean("editor.code_folding")); + textArea.setAutoIndentEnabled(PreferencesData.getBoolean("editor.indent")); + textArea.setCloseCurlyBraces(PreferencesData.getBoolean("editor.auto_close_braces", true)); textArea.setAntiAliasingEnabled(PreferencesData.getBoolean("editor.antialias")); textArea.setTabsEmulated(PreferencesData.getBoolean("editor.tabs.expand")); textArea.setTabSize(PreferencesData.getInteger("editor.tabs.size")); @@ -598,4 +600,4 @@ public boolean requestFocusInWindow() { return textarea.requestFocusInWindow(); } -} \ No newline at end of file +} diff --git a/arduino-core/src/processing/app/PreferencesData.java b/arduino-core/src/processing/app/PreferencesData.java index 6757e7e6e49..3de047a2ec4 100644 --- a/arduino-core/src/processing/app/PreferencesData.java +++ b/arduino-core/src/processing/app/PreferencesData.java @@ -176,6 +176,13 @@ static public void unset(String attribute) { prefs.remove(attribute); } + static public boolean getBoolean(String attribute, boolean defaultValue) { + if (has(attribute)) { + return getBoolean(attribute); + } + + return defaultValue; + } static public boolean getBoolean(String attribute) { return prefs.getBoolean(attribute); diff --git a/build/shared/lib/preferences.txt b/build/shared/lib/preferences.txt index 8657dd50b27..ec1852e58c6 100644 --- a/build/shared/lib/preferences.txt +++ b/build/shared/lib/preferences.txt @@ -146,6 +146,9 @@ editor.tabs.size = 2 # automatically indent each line editor.indent = true +# enable/disable auto-close of curly brace +editor.auto_close_braces = true + # size of divider between editing area and the console editor.divider.size = 0 # the larger divider on windows is ugly with the little arrows