diff --git a/devtools/client/preferences/devtools-client.js b/devtools/client/preferences/devtools-client.js index eaddd09bd90d..c38afeed4739 100644 --- a/devtools/client/preferences/devtools-client.js +++ b/devtools/client/preferences/devtools-client.js @@ -266,10 +266,6 @@ pref("devtools.netmonitor.persistlog", false); // any timestamps. pref("devtools.webconsole.timestampMessages", false); -// Web Console automatic multiline mode: |true| if you want incomplete statements -// to automatically trigger multiline editing (equivalent to shift + enter). -pref("devtools.webconsole.autoMultiline", true); - // Enable the webconsole sidebar toggle in Nightly builds. #if defined(NIGHTLY_BUILD) pref("devtools.webconsole.sidebarToggle", true); diff --git a/devtools/client/webconsole/components/JSTerm.js b/devtools/client/webconsole/components/JSTerm.js index 66199a98a81c..77d29d49ff11 100644 --- a/devtools/client/webconsole/components/JSTerm.js +++ b/devtools/client/webconsole/components/JSTerm.js @@ -23,7 +23,6 @@ loader.lazyRequireGetter(this, "Telemetry", "devtools/client/shared/telemetry"); const l10n = require("devtools/client/webconsole/webconsole-l10n"); const HELP_URL = "https://developer.mozilla.org/docs/Tools/Web_Console/Helpers"; -const PREF_AUTO_MULTILINE = "devtools.webconsole.autoMultiline"; function gSequenceId() { return gSequenceId.n++; @@ -201,16 +200,13 @@ class JSTerm extends Component { viewportMargin: Infinity, extraKeys: { "Enter": (e, cm) => { - let autoMultiline = Services.prefs.getBoolPref(PREF_AUTO_MULTILINE); - if (e.shiftKey - || ( - !Debugger.isCompilableUnit(this.getInputValue()) - && autoMultiline - ) - ) { + if (!this.autocompletePopup.isOpen && ( + e.shiftKey || !Debugger.isCompilableUnit(this.getInputValue()) + )) { // shift return or incomplete statement return "CodeMirror.Pass"; } + this.execute(); return null; }, @@ -685,9 +681,9 @@ class JSTerm extends Component { } return; } else if (event.keyCode == KeyCodes.DOM_VK_RETURN) { - let autoMultiline = Services.prefs.getBoolPref(PREF_AUTO_MULTILINE); - if (event.shiftKey || - (!Debugger.isCompilableUnit(inputNode.value) && autoMultiline)) { + if (!this.autocompletePopup.isOpen && ( + event.shiftKey || !Debugger.isCompilableUnit(this.getInputValue()) + )) { // shift return or incomplete statement return; } diff --git a/devtools/client/webconsole/local-dev/index.js b/devtools/client/webconsole/local-dev/index.js index 3215e1b2f8e1..628e548d2292 100644 --- a/devtools/client/webconsole/local-dev/index.js +++ b/devtools/client/webconsole/local-dev/index.js @@ -37,7 +37,6 @@ pref("devtools.webconsole.ui.filterbar", false); pref("devtools.webconsole.inputHistoryCount", 50); pref("devtools.webconsole.persistlog", false); pref("devtools.webconsole.timestampMessages", false); -pref("devtools.webconsole.autoMultiline", true); pref("devtools.webconsole.sidebarToggle", true); const WebConsoleOutputWrapper = require("../webconsole-output-wrapper"); diff --git a/devtools/client/webconsole/test/mocha-test-setup.js b/devtools/client/webconsole/test/mocha-test-setup.js index ac4a44649092..b83335e7a2ae 100644 --- a/devtools/client/webconsole/test/mocha-test-setup.js +++ b/devtools/client/webconsole/test/mocha-test-setup.js @@ -23,7 +23,6 @@ pref("devtools.webconsole.ui.filterbar", false); pref("devtools.webconsole.inputHistoryCount", 50); pref("devtools.webconsole.persistlog", false); pref("devtools.webconsole.timestampMessages", false); -pref("devtools.webconsole.autoMultiline", true); pref("devtools.webconsole.sidebarToggle", true); global.loader = { diff --git a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_return_key.js b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_return_key.js index b86c3034ad83..17f563ecf560 100644 --- a/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_return_key.js +++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_autocomplete_return_key.js @@ -24,12 +24,7 @@ const TEST_URI = `data:text/html;charset=utf-8, bug 585991 - test pressing return with open popup`; -// We should turn off auto-multiline editing during these tests -const PREF_AUTO_MULTILINE = "devtools.webconsole.autoMultiline"; - add_task(async function() { - Services.prefs.setBoolPref(PREF_AUTO_MULTILINE, false); - let { jsterm } = await openNewTabAndConsole(TEST_URI); const { autocompletePopup: popup, @@ -74,6 +69,4 @@ add_task(async function() { is(jsterm.getInputValue(), "window.foobar.item3", "completion was successful after KEY_Enter"); ok(!completeNode.value, "completeNode is empty"); - - Services.prefs.clearUserPref(PREF_AUTO_MULTILINE); });