Merge pull request #641 from ueokande/cancel-by-ctrl-c

Cancel console by Ctrl+C
jh-changes
Shin'ya Ueoka 5 years ago committed by GitHub
commit 0fc2eea743
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/console/components/Console.tsx
  2. 8
      src/content/InputDriver.ts

@ -72,6 +72,13 @@ class Console extends React.Component<Props> {
break; break;
case '[': case '[':
if (e.ctrlKey) { 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()); return this.props.dispatch(consoleActions.hideCommand());
} }
break; break;

@ -2,7 +2,13 @@ import * as dom from '../shared/utils/dom';
import Key, * as keys from './domains/Key'; import Key, * as keys from './domains/Key';
const cancelKey = (e: KeyboardEvent): boolean => { 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 { export default class InputDriver {