mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
parent
9df56a7fe0
commit
87d4c2b37e
4 changed files with 21 additions and 2 deletions
|
|
@ -29,6 +29,9 @@ const commands = {
|
||||||
'editor:clearBuffer': focusedWindow => {
|
'editor:clearBuffer': focusedWindow => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('session clear req');
|
focusedWindow && focusedWindow.rpc.emit('session clear req');
|
||||||
},
|
},
|
||||||
|
'editor:selectAll': focusedWindow => {
|
||||||
|
focusedWindow.rpc.emit('term selectAll');
|
||||||
|
},
|
||||||
'plugins:update': () => {
|
'plugins:update': () => {
|
||||||
updatePlugins();
|
updatePlugins();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,11 @@ module.exports = (commandKeys, execCommand) => {
|
||||||
accelerator: commandKeys['editor:paste']
|
accelerator: commandKeys['editor:paste']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
role: 'selectall',
|
label: 'Select All',
|
||||||
accelerator: commandKeys['editor:selectAll']
|
accelerator: commandKeys['editor:selectAll'],
|
||||||
|
click(item, focusedWindow) {
|
||||||
|
execCommand('editor:selectAll', focusedWindow);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'separator'
|
type: 'separator'
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,10 @@ export default class Term extends PureComponent {
|
||||||
this.term.resize(cols, rows);
|
this.term.resize(cols, rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectAll() {
|
||||||
|
this.term.selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
fitResize() {
|
fitResize() {
|
||||||
if (!this.termWrapperRef) {
|
if (!this.termWrapperRef) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ class Hyper extends PureComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.handleFocusActive = this.handleFocusActive.bind(this);
|
this.handleFocusActive = this.handleFocusActive.bind(this);
|
||||||
|
this.handleSelectAll = this.handleSelectAll.bind(this);
|
||||||
this.onTermsRef = this.onTermsRef.bind(this);
|
this.onTermsRef = this.onTermsRef.bind(this);
|
||||||
this.mousetrap = null;
|
this.mousetrap = null;
|
||||||
this.state = {
|
this.state = {
|
||||||
|
|
@ -45,6 +46,13 @@ class Hyper extends PureComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleSelectAll() {
|
||||||
|
const term = this.terms.getActiveTerm();
|
||||||
|
if (term) {
|
||||||
|
term.selectAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
attachKeyListeners() {
|
attachKeyListeners() {
|
||||||
if (!this.mousetrap) {
|
if (!this.mousetrap) {
|
||||||
this.mousetrap = new Mousetrap(window, true);
|
this.mousetrap = new Mousetrap(window, true);
|
||||||
|
|
@ -74,6 +82,7 @@ class Hyper extends PureComponent {
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.attachKeyListeners();
|
this.attachKeyListeners();
|
||||||
|
window.rpc.on('term selectAll', this.handleSelectAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
onTermsRef(terms) {
|
onTermsRef(terms) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue