From 672af30a2e919830f1798818a600ca2063532f59 Mon Sep 17 00:00:00 2001 From: Nisarg Jhaveri Date: Wed, 10 Dec 2014 14:42:51 +0530 Subject: [PATCH 1/2] Navigate history with arrow keys, rfe_1570 Signed-off-by: Nisarg Jhaveri --- js/console.js | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 1 deletion(-) diff --git a/js/console.js b/js/console.js index d832297001..6d75a7d58c 100644 --- a/js/console.js +++ b/js/console.js @@ -470,6 +470,16 @@ var PMA_consoleInput = { * @access private */ _codemirror: false, + /** + * @var int, count for history navigation, 0 for current input + * @access private + */ + _historyCount: 0, + /** + * @var string, current input when navigating through history + * @access private + */ + _historyPreserveCurrent: null, /** * Used for console input initialize * @@ -493,6 +503,9 @@ var PMA_consoleInput = { hintOptions: {"completeSingle": false, "completeOnSingleClick": true} }); PMA_consoleInput._inputs.console.on("inputRead", codemirrorAutocompleteOnInputRead); + PMA_consoleInput._inputs.console.on("keydown", function(instance, event) { + PMA_consoleInput._historyNavigate(event); + }); if ($('#pma_bookmarks').length !== 0) { PMA_consoleInput._inputs.bookmark = CodeMirror($('#pma_console .bookmark_add_input')[0], { theme: 'pma', @@ -505,7 +518,8 @@ var PMA_consoleInput = { } } else { PMA_consoleInput._inputs.console = - $('