From 60358e7ac47ea38b54cd3cee1e19fa0118132ed3 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Mon, 10 Dec 2018 13:08:57 +0100 Subject: [PATCH] xterm copy-on-select (fixes #400) --- terminus-terminal/src/frontends/xtermFrontend.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/terminus-terminal/src/frontends/xtermFrontend.ts b/terminus-terminal/src/frontends/xtermFrontend.ts index a1331edb..b4933d1b 100644 --- a/terminus-terminal/src/frontends/xtermFrontend.ts +++ b/terminus-terminal/src/frontends/xtermFrontend.ts @@ -16,6 +16,7 @@ export class XTermFrontend extends Frontend { private zoom = 0 private resizeHandler: any private configuredTheme: ITheme = {} + private copyOnSelect = false constructor () { super() @@ -33,6 +34,11 @@ export class XTermFrontend extends Frontend { this.xterm.on('title', title => { this.title.next(title) }) + this.xterm.on('selection', () => { + if (this.copyOnSelect) { + this.copySelection() + } + }) } attach (host: HTMLElement): void { @@ -101,6 +107,8 @@ export class XTermFrontend extends Frontend { this.configuredFontSize = config.terminal.fontSize this.setFontSize() + this.copyOnSelect = config.terminal.copyOnSelect + let theme: ITheme = { foreground: config.terminal.colorScheme.foreground, background: (config.terminal.background === 'colorScheme') ? config.terminal.colorScheme.background : 'transparent',