From cb8b72a319789f5f74b7044b8be36cfe26471417 Mon Sep 17 00:00:00 2001 From: Renato Campos Date: Mon, 18 Dec 2017 16:17:20 +0000 Subject: [PATCH] Added keymap to rebind the 'break' command - Issue #2432 (#2531) * fixed documentation of roleCommands * Added keymap for break/interrupt command * added break keymap for linux and darwin * fixed lint errors --- app/commands.js | 3 +++ app/keymaps/darwin.json | 1 + app/keymaps/linux.json | 1 + app/keymaps/win32.json | 1 + lib/command-registry.js | 2 +- lib/index.js | 4 ++++ 6 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/commands.js b/app/commands.js index d566c018..fa1d9a87 100644 --- a/app/commands.js +++ b/app/commands.js @@ -93,6 +93,9 @@ const commands = { }, 'editor:deleteEndLine': focusedWindow => { focusedWindow && focusedWindow.rpc.emit('session del line end req'); + }, + 'editor:break': focusedWindow => { + focusedWindow && focusedWindow.rpc.emit('session break req'); } }; diff --git a/app/keymaps/darwin.json b/app/keymaps/darwin.json index b39551d3..32938ba0 100644 --- a/app/keymaps/darwin.json +++ b/app/keymaps/darwin.json @@ -46,5 +46,6 @@ "editor:deleteEndLine": "command+delete", "editor:clearBuffer": "command+k", "editor:emojis": "command+ctrl+space", + "editor:break": "ctrl+c", "plugins:update": "command+shift+u" } diff --git a/app/keymaps/linux.json b/app/keymaps/linux.json index e74b2f1e..85615cc0 100644 --- a/app/keymaps/linux.json +++ b/app/keymaps/linux.json @@ -45,5 +45,6 @@ "editor:deleteBeginningLine": "ctrl+home", "editor:deleteEndLine": "ctrl+end", "editor:clearBuffer": "ctrl+shift+k", + "editor:break": "ctrl+c", "plugins:update": "ctrl+shift+u" } diff --git a/app/keymaps/win32.json b/app/keymaps/win32.json index 200bbd1e..76c68f1d 100644 --- a/app/keymaps/win32.json +++ b/app/keymaps/win32.json @@ -48,5 +48,6 @@ "editor:deleteBeginningLine": "ctrl+home", "editor:deleteEndLine": "ctrl+end", "editor:clearBuffer": "ctrl+shift+k", + "editor:break": "ctrl+c", "plugins:update": "ctrl+shift+u" } diff --git a/lib/command-registry.js b/lib/command-registry.js index ebf78517..41e9fabe 100644 --- a/lib/command-registry.js +++ b/lib/command-registry.js @@ -28,7 +28,7 @@ export const getCommandHandler = command => { return commands[command]; }; -// Some commands are firectly excuted by Electron menuItem role. +// Some commands are directly excuted by Electron menuItem role. // They should not be prevented to reach Electron. const roleCommands = [ 'window:close', diff --git a/lib/index.js b/lib/index.js index b2ee32c7..5dcd4df5 100644 --- a/lib/index.js +++ b/lib/index.js @@ -99,6 +99,10 @@ rpc.on('session del line end req', () => { store_.dispatch(sessionActions.sendSessionData(null, '\x10B')); }); +rpc.on('session break req', () => { + store_.dispatch(sessionActions.sendSessionData(null, '\x03')); +}); + rpc.on('termgroup add req', () => { store_.dispatch(termGroupActions.requestTermGroup()); });