Bug 988569 - Some fine tuning to suggestions showing logic. r=harth
authorGirish Sharma <scrapmachines@gmail.com>
Sat, 19 Apr 2014 18:15:51 +0530
changeset 180030 fd8dd096ffe4239ac033854b2a467ab21bcc73bd
parent 180029 162b121760e1dfba54bc7c30f91929ad461b7e73
child 180031 290e0e14312ffe31ef215fafe77a0e7f084b2e31
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersharth
bugs988569
milestone31.0a1
Bug 988569 - Some fine tuning to suggestions showing logic. r=harth
browser/devtools/sourceeditor/autocomplete.js
--- a/browser/devtools/sourceeditor/autocomplete.js
+++ b/browser/devtools/sourceeditor/autocomplete.js
@@ -164,17 +164,35 @@ function onEditorKeypress({ ed, Editor }
 
   // Do not try to autocomplete with multiple selections.
   if (ed.hasMultipleSelections()) {
     private.doNotAutocomplete = true;
     private.popup.hidePopup();
     return;
   }
 
+  if ((event.ctrlKey || event.metaKey) && event.keyCode == event.DOM_VK_SPACE) {
+    // When Ctrl/Cmd + Space is pressed, two simultaneous keypresses are emitted
+    // first one for just the Ctrl/Cmd and second one for combo. The first one
+    // leave the private.doNotAutocomplete as true, so we have to make it false
+    private.doNotAutocomplete = false;
+    return;
+  }
+
+  if (event.ctrlKey || event.metaKey || event.altKey) {
+    private.doNotAutocomplete = true;
+    private.popup.hidePopup();
+    return;
+  }
+
   switch (event.keyCode) {
+    case event.DOM_VK_RETURN:
+      private.doNotAutocomplete = true;
+      break;
+
     case event.DOM_VK_ESCAPE:
       if (private.popup.isOpen)
         event.preventDefault();
     case event.DOM_VK_LEFT:
     case event.DOM_VK_RIGHT:
     case event.DOM_VK_HOME:
     case event.DOM_VK_END:
       private.doNotAutocomplete = true;