Fix selectAll command (#2436)

* Fix selectAll command

* Fix typo
This commit is contained in:
CHaBou 2018-01-21 12:21:16 +01:00 committed by Albin Ekblom
parent 9df56a7fe0
commit 87d4c2b37e
4 changed files with 21 additions and 2 deletions

View file

@ -195,6 +195,10 @@ export default class Term extends PureComponent {
this.term.resize(cols, rows);
}
selectAll() {
this.term.selectAll();
}
fitResize() {
if (!this.termWrapperRef) {
return;

View file

@ -18,6 +18,7 @@ class Hyper extends PureComponent {
constructor(props) {
super(props);
this.handleFocusActive = this.handleFocusActive.bind(this);
this.handleSelectAll = this.handleSelectAll.bind(this);
this.onTermsRef = this.onTermsRef.bind(this);
this.mousetrap = null;
this.state = {
@ -45,6 +46,13 @@ class Hyper extends PureComponent {
}
}
handleSelectAll() {
const term = this.terms.getActiveTerm();
if (term) {
term.selectAll();
}
}
attachKeyListeners() {
if (!this.mousetrap) {
this.mousetrap = new Mousetrap(window, true);
@ -74,6 +82,7 @@ class Hyper extends PureComponent {
componentDidMount() {
this.attachKeyListeners();
window.rpc.on('term selectAll', this.handleSelectAll);
}
onTermsRef(terms) {