From dce8647f55fe3650198abe8eef7bd21d6211e2a9 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Fri, 30 Mar 2018 23:42:50 +0200 Subject: [PATCH] smart ctrl-c behaviour (fixes #307) --- terminus-terminal/src/components/terminalTab.component.ts | 8 ++++++++ terminus-terminal/src/config.ts | 3 +++ 2 files changed, 11 insertions(+) diff --git a/terminus-terminal/src/components/terminalTab.component.ts b/terminus-terminal/src/components/terminalTab.component.ts index 88432268..ed57fed4 100644 --- a/terminus-terminal/src/components/terminalTab.component.ts +++ b/terminus-terminal/src/components/terminalTab.component.ts @@ -90,6 +90,13 @@ export class TerminalTabComponent extends BaseTabComponent { return } switch (hotkey) { + case 'ctrl-c': + if (this.hterm.getSelectionText()) { + this.hterm.copySelectionToClipboard() + } else { + this.sendInput('\x03') + } + break case 'copy': this.hterm.copySelectionToClipboard() break @@ -366,6 +373,7 @@ export class TerminalTabComponent extends BaseTabComponent { preferenceManager.set('alt-gr-mode', 'ctrl-alt') preferenceManager.set('pass-alt-number', true) preferenceManager.set('cursor-blink', config.terminal.cursorBlink) + preferenceManager.set('clear-selection-after-copy', true) if (config.terminal.colorScheme.foreground) { preferenceManager.set('foreground-color', config.terminal.colorScheme.foreground) diff --git a/terminus-terminal/src/config.ts b/terminus-terminal/src/config.ts index 74970cdf..8b402839 100644 --- a/terminus-terminal/src/config.ts +++ b/terminus-terminal/src/config.ts @@ -53,6 +53,7 @@ export class TerminalConfigProvider extends ConfigProvider { persistence: 'screen', }, hotkeys: { + 'ctrl-c': ['Ctrl-C'], 'copy': [ '⌘-C', ], @@ -96,6 +97,7 @@ export class TerminalConfigProvider extends ConfigProvider { copyOnSelect: true, }, hotkeys: { + 'ctrl-c': ['Ctrl-C'], 'copy': [ 'Ctrl-Shift-C', ], @@ -136,6 +138,7 @@ export class TerminalConfigProvider extends ConfigProvider { persistence: 'tmux', }, hotkeys: { + 'ctrl-c': ['Ctrl-C'], 'copy': [ 'Ctrl-Shift-C', ],