Ensure we can edit grid values in the debugger using keyboard shortcuts. Fixes #3153

This commit is contained in:
Murtuza Zabuawala
2018-03-02 15:05:04 +00:00
committed by Dave Page
parent efcf87636d
commit 92a0bb605d
5 changed files with 88 additions and 9 deletions

View File

@@ -0,0 +1,23 @@
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin 4 - PostgreSQL Tools
//
// Copyright (C) 2013 - 2018, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
//////////////////////////////////////////////////////////////////////////
function setFocusToDebuggerEditor(editor, command) {
const TAB = 9;
if (!command)
return;
let key = command.which || command.keyCode;
// Keys other than Tab key
if (key !== TAB) {
editor.focus();
}
}
module.exports = {
setFocusToDebuggerEditor: setFocusToDebuggerEditor,
};

View File

@@ -2,10 +2,11 @@ define([
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
'pgadmin.alertifyjs', 'sources/pgadmin', 'pgadmin.browser', 'backbone',
'pgadmin.backgrid', 'pgadmin.backform', 'sources/../bundle/codemirror',
'pgadmin.tools.debugger.ui', 'sources/keyboard_shortcuts', 'wcdocker',
'pgadmin.tools.debugger.ui', 'sources/keyboard_shortcuts',
'pgadmin.tools.debugger.utils', 'wcdocker',
], function(
gettext, url_for, $, _, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid,
Backform, codemirror, debug_function_again, keyboardShortcuts
Backform, codemirror, debug_function_again, keyboardShortcuts, debuggerUtils
) {
var CodeMirror = codemirror.default,
@@ -185,7 +186,6 @@ define([
'CodeMirror-activeline-background'
);
}
// Call function to create and update local variables ....
self.GetStackInformation(trans_id);
if (pgTools.DirectDebug.debug_type) {
@@ -345,7 +345,6 @@ define([
'wrap', 'CodeMirror-activeline-background'
);
self.active_line_no = (res.data.result[0].linenumber - 2);
// Update the stack, local variables and parameters information
self.GetStackInformation(trans_id);
@@ -1211,8 +1210,10 @@ define([
});
variable_grid.collection.on(
'backgrid:edited', () => {
pgTools.DirectDebug.editor.focus();
'backgrid:edited', (ch1, ch2, command) => {
debuggerUtils.setFocusToDebuggerEditor(
pgTools.DirectDebug.editor, command
);
}
);
@@ -1294,8 +1295,10 @@ define([
});
param_grid.collection.on(
'backgrid:edited', () => {
pgTools.DirectDebug.editor.focus();
'backgrid:edited', (ch1, ch2, command) => {
debuggerUtils.setFocusToDebuggerEditor(
pgTools.DirectDebug.editor, command
);
}
);
@@ -1371,7 +1374,6 @@ define([
(res.data.result[0].linenumber - 2), 'wrap',
'CodeMirror-activeline-background'
);
// Call function to create and update local variables ....
self.GetLocalVariables(pgTools.DirectDebug.trans_id);
}