Bug 963937 - Add a pref to disable automatic bracket closing in source editor. r=anton

This commit is contained in:
Dagger
2014-01-30 20:21:00 -08:00
parent c3244c90a5
commit 989d37be8b
2 changed files with 10 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ const { Cu, Cc, Ci, components } = require("chrome");
const TAB_SIZE = "devtools.editor.tabsize";
const EXPAND_TAB = "devtools.editor.expandtab";
const KEYMAP = "devtools.editor.keymap";
const AUTO_CLOSE = "devtools.editor.autoclosebrackets";
const L10N_BUNDLE = "chrome://browser/locale/devtools/sourceeditor.properties";
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
@@ -132,6 +133,7 @@ function Editor(config) {
const tabSize = Services.prefs.getIntPref(TAB_SIZE);
const useTabs = !Services.prefs.getBoolPref(EXPAND_TAB);
const keyMap = Services.prefs.getCharPref(KEYMAP);
const useAutoClose = Services.prefs.getBoolPref(AUTO_CLOSE);
this.version = null;
this.config = {
@@ -144,7 +146,8 @@ function Editor(config) {
extraKeys: {},
indentWithTabs: useTabs,
styleActiveLine: true,
autoCloseBrackets: true,
autoCloseBrackets: "()[]{}''\"\"",
autoCloseEnabled: useAutoClose,
theme: "mozilla"
};
@@ -187,6 +190,10 @@ function Editor(config) {
}
}
// Configure automatic bracket closing.
if (!this.config.autoCloseEnabled)
this.config.autoCloseBrackets = false;
// Overwrite default tab behavior. If something is selected,
// indent those lines. If nothing is selected and we're
// indenting with tabs, insert one tab. Otherwise insert N