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.
jh-changes
Shinya Ohyanagi 7 years ago
parent a50c7dd0a2
commit b1d186b662
  1. 28
      src/console/components/console.js

@ -48,6 +48,34 @@ export default class ConsoleComponent {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
break; 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;
} }
} }