diff --git a/app/yarn.lock b/app/yarn.lock index b7abf070..eb6d74e7 100644 --- a/app/yarn.lock +++ b/app/yarn.lock @@ -114,10 +114,10 @@ dependencies: debug "^4.3.2" -"@tabby-gang/node-pty@^0.11.0-beta.202": - version "0.11.0-beta.202" - resolved "https://registry.yarnpkg.com/@tabby-gang/node-pty/-/node-pty-0.11.0-beta.202.tgz#4d6302f7db226f56de4f01303c9f4abd9a9d7a0f" - integrity sha512-Z/hgI2bjWE6c0nYlCmduNnMVorGgj5868xWX2BxCB0DjsmnMSuO8ktsYjXHIV//JBqIed8TUBdS+x/mQvg/ZUQ== +"@tabby-gang/node-pty@^0.11.0-beta.203": + version "0.11.0-beta.204" + resolved "https://registry.yarnpkg.com/@tabby-gang/node-pty/-/node-pty-0.11.0-beta.204.tgz#80d4393c7a233d3298f47a4755467a246b0099f9" + integrity sha512-sNT5Z2MEkEIhToAdVAdZ/lfeQ9UgFE3h2ENlOux+WHBrl1k0BiUEIOd/jh/K3mNAGEfcZ44gNQQ50g5KXTQEmA== dependencies: nan "^2.16.0" diff --git a/tabby-terminal/src/api/baseTerminalTab.component.ts b/tabby-terminal/src/api/baseTerminalTab.component.ts index 1a07955b..a17efe05 100644 --- a/tabby-terminal/src/api/baseTerminalTab.component.ts +++ b/tabby-terminal/src/api/baseTerminalTab.component.ts @@ -462,7 +462,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit data = data.replaceAll('\n', '\r') } - if (data.indexOf('\n') === data.length - 1) { + if (this.config.store.terminal.trimWhitespaceOnPaste && data.indexOf('\n') === data.length - 1) { // Ends with a newline and has no other line breaks data = data.substring(0, data.length - 1) } @@ -487,7 +487,9 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit return } } else { - data = data.trim() + if (this.config.store.terminal.trimWhitespaceOnPaste) { + data = data.trim() + } } } diff --git a/tabby-terminal/src/components/terminalSettingsTab.component.pug b/tabby-terminal/src/components/terminalSettingsTab.component.pug index 2cee3da7..8a8d263d 100644 --- a/tabby-terminal/src/components/terminalSettingsTab.component.pug +++ b/tabby-terminal/src/components/terminalSettingsTab.component.pug @@ -153,6 +153,15 @@ div.mt-4 (ngModelChange)='config.save()', ) + .form-line + .header + .title(translate) Trim whitespace and newlines + .description(translate) Remove whitespace and newlines around the copied text + toggle( + [(ngModel)]='config.store.terminal.trimWhitespaceOnPaste', + (ngModelChange)='config.save()', + ) + div.mt-4 h3(translate) Sound diff --git a/tabby-terminal/src/config.ts b/tabby-terminal/src/config.ts index ef7ccc6c..70b8d0c7 100644 --- a/tabby-terminal/src/config.ts +++ b/tabby-terminal/src/config.ts @@ -70,6 +70,7 @@ export class TerminalConfigProvider extends ConfigProvider { drawBoldTextInBrightColors: true, sixel: true, minimumContrastRatio: 4, + trimWhitespaceOnPaste: true, }, }