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

Cancel console by Ctrl+C
This commit is contained in:
Shin'ya Ueoka 2019-09-05 12:48:10 +00:00 committed by GitHub
commit 0fc2eea743
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -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;

View file

@ -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 {