Hi,

PFA patch to fix the issue where pressing Ctrl + Alt + . on query tool
editor window triggers Inline uncomment code functionality which is wrong
it should only trigger if user presses Ctrl + .
RM#2769

Tested on macOS, Linux, Windows with web version.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/static/js/sqleditor/keyboard_shortcuts.js 
b/web/pgadmin/static/js/sqleditor/keyboard_shortcuts.js
index c617562..9e593a2 100644
--- a/web/pgadmin/static/js/sqleditor/keyboard_shortcuts.js
+++ b/web/pgadmin/static/js/sqleditor/keyboard_shortcuts.js
@@ -23,16 +23,22 @@ function keyboardShortcuts(sqlEditorController, 
queryToolActions, event) {
   } else if (keyCode === F8_KEY) {
     event.preventDefault();
     queryToolActions.download(sqlEditorController);
-  } else if (((this.isMac() && event.metaKey) || (!this.isMac() && 
event.ctrlKey)) &&
-    event.shiftKey && keyCode === FWD_SLASH_KEY) {
+  } else if ((
+     (this.isMac() && event.metaKey) ||
+     (!this.isMac() && event.ctrlKey)
+    ) && !event.altKey && event.shiftKey && keyCode === FWD_SLASH_KEY) {
     _stopEventPropagation();
     queryToolActions.commentBlockCode(sqlEditorController);
-  } else if (((this.isMac() && event.metaKey) || (!this.isMac() && 
event.ctrlKey)) &&
-    keyCode === FWD_SLASH_KEY) {
+  } else if ((
+     (this.isMac() && !this.isKeyCtrlAltShift(event) && event.metaKey) ||
+     (!this.isMac() && !this.isKeyAltShift(event) && event.ctrlKey)
+    ) && keyCode === FWD_SLASH_KEY) {
     _stopEventPropagation();
     queryToolActions.commentLineCode(sqlEditorController);
-  } else if (((this.isMac() && event.metaKey) || (!this.isMac() && 
event.ctrlKey)) &&
-    keyCode === PERIOD_KEY) {
+  } else if ((
+     (this.isMac() && !this.isKeyCtrlAltShift(event) && event.metaKey) ||
+     (!this.isMac() && !this.isKeyAltShift(event) && event.ctrlKey)
+    ) && keyCode === PERIOD_KEY) {
     _stopEventPropagation();
     queryToolActions.uncommentLineCode(sqlEditorController);
   }
@@ -49,7 +55,27 @@ function isMac() {
   return window.navigator.platform.search('Mac') != -1;
 }
 
+function isKeyCtrlAlt(event) {
+  return event.ctrlKey || event.altKey;
+}
+
+function isKeyAltShift(event) {
+  return event.altKey || event.shiftKey;
+}
+
+function isKeyCtrlShift(event) {
+  return event.ctrlKey || event.shiftKey;
+}
+
+function isKeyCtrlAltShift(event) {
+  return event.ctrlKey || event.altKey || event.shiftKey;
+}
+
 module.exports = {
   processEvent: keyboardShortcuts,
   isMac: isMac,
+  isKeyCtrlAlt: isKeyCtrlAlt,
+  isKeyAltShift: isKeyAltShift,
+  isKeyCtrlShift: isKeyCtrlShift,
+  isKeyCtrlAltShift: isKeyCtrlAltShift
 };

Reply via email to