aboutsummaryrefslogtreecommitdiff
path: root/src/console/components/console.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-05-01 15:51:40 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-05-01 15:51:40 +0900
commit9da2f5fd786ff7ef64eca0a86efb1c0b9a164244 (patch)
treeb888349817d0016dc1499932671bbe6cd95efdaa /src/console/components/console.js
parentf9889b7f2b634bfe5a540633d8952f4a6f900658 (diff)
parent89d6afecfd257ff4fc62748f771abf37ef3a2852 (diff)
Merge remote-tracking branch 'origin/master' into patch-1
Diffstat (limited to 'src/console/components/console.js')
-rw-r--r--src/console/components/console.js45
1 files changed, 42 insertions, 3 deletions
diff --git a/src/console/components/console.js b/src/console/components/console.js
index 7bc3364..a9ae4ed 100644
--- a/src/console/components/console.js
+++ b/src/console/components/console.js
@@ -31,14 +31,33 @@ export default class ConsoleComponent {
}
}
+ doEnter(e) {
+ e.stopPropagation();
+ e.preventDefault();
+ return this.onEntered(e.target.value);
+ }
+
+ selectNext(e) {
+ this.store.dispatch(consoleActions.completionNext());
+ e.stopPropagation();
+ e.preventDefault();
+ }
+
+ selectPrev(e) {
+ this.store.dispatch(consoleActions.completionPrev());
+ e.stopPropagation();
+ e.preventDefault();
+ }
+
onKeyDown(e) {
+ if (e.keyCode === KeyboardEvent.DOM_VK_ESCAPE && e.ctrlKey) {
+ return this.hideCommand();
+ }
switch (e.keyCode) {
case KeyboardEvent.DOM_VK_ESCAPE:
return this.hideCommand();
case KeyboardEvent.DOM_VK_RETURN:
- e.stopPropagation();
- e.preventDefault();
- return this.onEntered(e.target.value);
+ return this.doEnter(e);
case KeyboardEvent.DOM_VK_TAB:
if (e.shiftKey) {
this.store.dispatch(consoleActions.completionPrev());
@@ -48,6 +67,26 @@ 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) {
+ return this.doEnter(e);
+ }
+ break;
+ case KeyboardEvent.DOM_VK_N:
+ if (e.ctrlKey) {
+ this.selectNext(e);
+ }
+ break;
+ case KeyboardEvent.DOM_VK_P:
+ if (e.ctrlKey) {
+ this.selectPrev(e);
+ }
+ break;
}
}