mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Fix commands without active window (#2473)
This commit is contained in:
parent
1d2b7818ec
commit
1e14494ec9
1 changed files with 30 additions and 23 deletions
|
|
@ -8,33 +8,40 @@ const commands = {
|
|||
setTimeout(app.createWindow, 0);
|
||||
},
|
||||
'tab:new': focusedWindow => {
|
||||
focusedWindow.rpc.emit('termgroup add req');
|
||||
if (focusedWindow) {
|
||||
focusedWindow.rpc.emit('termgroup add req');
|
||||
} else {
|
||||
setTimeout(app.createWindow, 0);
|
||||
}
|
||||
},
|
||||
'pane:splitVertical': focusedWindow => {
|
||||
focusedWindow.rpc.emit('split request vertical');
|
||||
focusedWindow && focusedWindow.rpc.emit('split request vertical');
|
||||
},
|
||||
'pane:splitHorizontal': focusedWindow => {
|
||||
focusedWindow.rpc.emit('split request horizontal');
|
||||
focusedWindow && focusedWindow.rpc.emit('split request horizontal');
|
||||
},
|
||||
'pane:close': focusedWindow => {
|
||||
focusedWindow.rpc.emit('termgroup close req');
|
||||
focusedWindow && focusedWindow.rpc.emit('termgroup close req');
|
||||
},
|
||||
'window:preferences': () => {
|
||||
openConfig();
|
||||
},
|
||||
'editor:clearBuffer': focusedWindow => {
|
||||
focusedWindow.rpc.emit('session clear req');
|
||||
focusedWindow && focusedWindow.rpc.emit('session clear req');
|
||||
},
|
||||
'plugins:update': () => {
|
||||
updatePlugins();
|
||||
},
|
||||
'window:reload': focusedWindow => {
|
||||
focusedWindow.rpc.emit('reload');
|
||||
focusedWindow && focusedWindow.rpc.emit('reload');
|
||||
},
|
||||
'window:reloadFull': focusedWindow => {
|
||||
focusedWindow.reload();
|
||||
focusedWindow && focusedWindow.reload();
|
||||
},
|
||||
'window:devtools': focusedWindow => {
|
||||
if (!focusedWindow) {
|
||||
return;
|
||||
}
|
||||
const webContents = focusedWindow.webContents;
|
||||
if (webContents.isDevToolsOpened()) {
|
||||
webContents.closeDevTools();
|
||||
|
|
@ -43,49 +50,49 @@ const commands = {
|
|||
}
|
||||
},
|
||||
'zoom:reset': focusedWindow => {
|
||||
focusedWindow.rpc.emit('reset fontSize req');
|
||||
focusedWindow && focusedWindow.rpc.emit('reset fontSize req');
|
||||
},
|
||||
'zoom:in': focusedWindow => {
|
||||
focusedWindow.rpc.emit('increase fontSize req');
|
||||
focusedWindow && focusedWindow.rpc.emit('increase fontSize req');
|
||||
},
|
||||
'zoom:out': focusedWindow => {
|
||||
focusedWindow.rpc.emit('decrease fontSize req');
|
||||
focusedWindow && focusedWindow.rpc.emit('decrease fontSize req');
|
||||
},
|
||||
'tab:prev': focusedWindow => {
|
||||
focusedWindow.rpc.emit('move left req');
|
||||
focusedWindow && focusedWindow.rpc.emit('move left req');
|
||||
},
|
||||
'tab:next': focusedWindow => {
|
||||
focusedWindow.rpc.emit('move right req');
|
||||
focusedWindow && focusedWindow.rpc.emit('move right req');
|
||||
},
|
||||
'pane:prev': focusedWindow => {
|
||||
focusedWindow.rpc.emit('prev pane req');
|
||||
focusedWindow && focusedWindow.rpc.emit('prev pane req');
|
||||
},
|
||||
'pane:next': focusedWindow => {
|
||||
focusedWindow.rpc.emit('next pane req');
|
||||
focusedWindow && focusedWindow.rpc.emit('next pane req');
|
||||
},
|
||||
'editor:movePreviousWord': focusedWindow => {
|
||||
focusedWindow.rpc.emit('session move word left req');
|
||||
focusedWindow && focusedWindow.rpc.emit('session move word left req');
|
||||
},
|
||||
'editor:moveNextWord': focusedWindow => {
|
||||
focusedWindow.rpc.emit('session move word right req');
|
||||
focusedWindow && focusedWindow.rpc.emit('session move word right req');
|
||||
},
|
||||
'editor:moveBeginningLine': focusedWindow => {
|
||||
focusedWindow.rpc.emit('session move line beginning req');
|
||||
focusedWindow && focusedWindow.rpc.emit('session move line beginning req');
|
||||
},
|
||||
'editor:moveEndLine': focusedWindow => {
|
||||
focusedWindow.rpc.emit('session move line end req');
|
||||
focusedWindow && focusedWindow.rpc.emit('session move line end req');
|
||||
},
|
||||
'editor:deletePreviousWord': focusedWindow => {
|
||||
focusedWindow.rpc.emit('session del word left req');
|
||||
focusedWindow && focusedWindow.rpc.emit('session del word left req');
|
||||
},
|
||||
'editor:deleteNextWord': focusedWindow => {
|
||||
focusedWindow.rpc.emit('session del word right req');
|
||||
focusedWindow && focusedWindow.rpc.emit('session del word right req');
|
||||
},
|
||||
'editor:deleteBeginningLine': focusedWindow => {
|
||||
focusedWindow.rpc.emit('session del line beginning req');
|
||||
focusedWindow && focusedWindow.rpc.emit('session del line beginning req');
|
||||
},
|
||||
'editor:deleteEndLine': focusedWindow => {
|
||||
focusedWindow.rpc.emit('session del line end req');
|
||||
focusedWindow && focusedWindow.rpc.emit('session del line end req');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -93,7 +100,7 @@ const commands = {
|
|||
[1, 2, 3, 4, 5, 6, 7, 8, 'last'].forEach(cmdIndex => {
|
||||
const index = cmdIndex === 'last' ? cmdIndex : cmdIndex - 1;
|
||||
commands[`tab:jump:${cmdIndex}`] = focusedWindow => {
|
||||
focusedWindow.rpc.emit('move jump req', index);
|
||||
focusedWindow && focusedWindow.rpc.emit('move jump req', index);
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue