hyperterm: add ctrl+c for closing <webview> instead of cmd+w (#2)

This commit is contained in:
Guillermo Rauch 2016-07-02 10:53:39 -07:00
parent 8b025d8861
commit 09c85e8069

View file

@ -103,16 +103,16 @@ export default class HyperTerm extends Component {
closeTab () {
if (this.state.sessions.length) {
const uid = this.state.sessions[this.state.active];
this.rpc.emit('exit', { uid });
}
}
if (this.state.urls[uid]) {
// if we have a url loaded, closing a tab
// instead closes the url
const urls = Object.assign({}, this.state.urls);
delete urls[uid];
this.setState({ urls });
} else {
this.rpc.emit('exit', { uid });
}
closeBrowser () {
const uid = this.state.sessions[this.state.active];
if (this.state.urls[uid]) {
const urls = Object.assign({}, this.state.urls);
delete urls[uid];
this.setState({ urls });
}
}
@ -225,6 +225,8 @@ export default class HyperTerm extends Component {
Mousetrap.bind('command+8', this.moveTo.bind(this, 7));
Mousetrap.bind('command+9', this.moveTo.bind(this, 8));
Mousetrap.bind('ctrl+c', this.closeBrowser.bind(this));
Mousetrap.bind('command+shift+left', this.moveLeft);
Mousetrap.bind('command+shift+right', this.moveRight);