From 2e1204168876e3957c5ea1de237cb9cd0938bf5c Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sun, 19 Apr 2020 16:22:54 +0200 Subject: [PATCH] limit max html copy length --- terminus-terminal/src/frontends/xtermFrontend.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/terminus-terminal/src/frontends/xtermFrontend.ts b/terminus-terminal/src/frontends/xtermFrontend.ts index acb92d9a..0feeab6d 100644 --- a/terminus-terminal/src/frontends/xtermFrontend.ts +++ b/terminus-terminal/src/frontends/xtermFrontend.ts @@ -167,10 +167,17 @@ export class XTermFrontend extends Frontend { } copySelection (): void { - require('electron').remote.clipboard.write({ - text: this.getSelection(), - html: this.getSelectionAsHTML(), - }) + const text = this.getSelection() + if (text.length < 1024 * 32) { + require('electron').remote.clipboard.write({ + text: this.getSelection(), + html: this.getSelectionAsHTML(), + }) + } else { + require('electron').remote.clipboard.write({ + text: this.getSelection(), + }) + } } clearSelection (): void {