From b1d186b66216106329f1301e29892c1cac0fd9d2 Mon Sep 17 00:00:00 2001 From: Shinya Ohyanagi Date: Wed, 15 Nov 2017 22:42:09 +0900 Subject: Add c-n, c-p, c-m to console Add `c-n`, `c-j` for select next item. Add `c-p`, `c-k` for select previous item. Add `c-m` for select item. Above console keybinds are same as Vim(Vimperator)'s completion selector. --- src/console/components/console.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/console') diff --git a/src/console/components/console.js b/src/console/components/console.js index 7bc3364..cabd229 100644 --- a/src/console/components/console.js +++ b/src/console/components/console.js @@ -48,6 +48,34 @@ export default class ConsoleComponent { e.stopPropagation(); e.preventDefault(); break; + case KeyboardEvent.DOM_VK_OPEN_BRACKET: + if (e.ctrlKey) { + return this.hideCommand(); + } + break; + case KeyboardEvent.DOM_VK_M: + if (e.ctrlKey) { + e.stopPropagation(); + e.preventDefault(); + return this.onEntered(e.target.value); + } + break; + case KeyboardEvent.DOM_VK_N: + case KeyboardEvent.DOM_VK_J: + if (e.ctrlKey) { + this.store.dispatch(consoleActions.completionNext()); + e.stopPropagation(); + e.preventDefault(); + } + break; + case KeyboardEvent.DOM_VK_P: + case KeyboardEvent.DOM_VK_K: + if (e.ctrlKey) { + this.store.dispatch(consoleActions.completionPrev()); + e.stopPropagation(); + e.preventDefault(); + } + break; } } -- cgit v1.2.3