Focus term if needed when restoring (#2658)

* Focus term if needed when restoring

* Fix Tab component warnings
This commit is contained in:
CHaBou 2018-02-03 17:00:30 +01:00 committed by GitHub
parent 4d8d56bfc5
commit 887fb5ac1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 10 deletions

View file

@ -14,10 +14,6 @@ export default class Tab extends PureComponent {
}; };
} }
shouldComponentUpdate() {
return true;
}
handleHover() { handleHover() {
this.setState({ this.setState({
hovered: true hovered: true

View file

@ -80,6 +80,9 @@ export default class Term extends PureComponent {
//We need to set options again after reattaching an existing term //We need to set options again after reattaching an existing term
Object.keys(this.termOptions).forEach(option => this.term.setOption(option, this.termOptions[option])); Object.keys(this.termOptions).forEach(option => this.term.setOption(option, this.termOptions[option]));
} }
if (this.props.isTermActive) {
this.term.focus();
}
this.onOpen(this.termOptions); this.onOpen(this.termOptions);
@ -88,12 +91,7 @@ export default class Term extends PureComponent {
} }
if (props.onActive) { if (props.onActive) {
this.term.on('focus', () => { this.term.on('focus', props.onActive);
// xterm@2 emits this event 2 times. Will be fixed in xterm@3.
if (!this.props.isTermActive) {
props.onActive();
}
});
} }
if (props.onData) { if (props.onData) {