aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-09-05 12:48:10 +0000
committerGitHub <noreply@github.com>2019-09-05 12:48:10 +0000
commit0fc2eea7431649f85c6e5d57cca66457f24bb14d (patch)
treeff7139f8047a23011c329f1c93eb79fac234cce3
parent428805e66f993884643136dc2d8267c53bd81588 (diff)
parentbf9bec21461991a1e4b7581446ecfe21091a9597 (diff)
Merge pull request #641 from ueokande/cancel-by-ctrl-c
Cancel console by Ctrl+C
-rw-r--r--src/console/components/Console.tsx7
-rw-r--r--src/content/InputDriver.ts8
2 files changed, 14 insertions, 1 deletions
diff --git a/src/console/components/Console.tsx b/src/console/components/Console.tsx
index 7da2f36..1743d15 100644
--- a/src/console/components/Console.tsx
+++ b/src/console/components/Console.tsx
@@ -72,6 +72,13 @@ class Console extends React.Component<Props> {
break;
case '[':
if (e.ctrlKey) {
+ e.preventDefault();
+ return this.props.dispatch(consoleActions.hideCommand());
+ }
+ break;
+ case 'c':
+ if (e.ctrlKey) {
+ e.preventDefault();
return this.props.dispatch(consoleActions.hideCommand());
}
break;
diff --git a/src/content/InputDriver.ts b/src/content/InputDriver.ts
index cddc825..0472088 100644
--- a/src/content/InputDriver.ts
+++ b/src/content/InputDriver.ts
@@ -2,7 +2,13 @@ import * as dom from '../shared/utils/dom';
import Key, * as keys from './domains/Key';
const cancelKey = (e: KeyboardEvent): boolean => {
- return e.key === 'Escape' || e.key === '[' && e.ctrlKey;
+ if (e.key === 'Escape') {
+ return true;
+ }
+ if (e.key === '[' && e.ctrlKey) {
+ return true;
+ }
+ return false;
};
export default class InputDriver {