From 220f7197d91adde2da8042c87071928e17a55192 Mon Sep 17 00:00:00 2001 From: iroaK <55340002+iiroak@users.noreply.github.com> Date: Thu, 7 May 2026 16:19:00 -0400 Subject: [PATCH] Add option to replace line breaks with spaces on paste (#11218) --- locale/app.pot | 8 ++++++++ locale/es-ES.po | 8 ++++++++ tabby-terminal/src/api/baseTerminalTab.component.ts | 4 ++++ .../src/components/terminalSettingsTab.component.pug | 9 +++++++++ tabby-terminal/src/config.ts | 1 + 5 files changed, 30 insertions(+) diff --git a/locale/app.pot b/locale/app.pot index 651c43ebd..db3c85afb 100644 --- a/locale/app.pot +++ b/locale/app.pot @@ -2313,6 +2313,14 @@ msgstr "" msgid "Trim whitespace and newlines" msgstr "" +#: locale/tmp-html/tabby-terminal/src/components/terminalSettingsTab.component.html:120 +msgid "Replace line breaks with spaces" +msgstr "" + +#: locale/tmp-html/tabby-terminal/src/components/terminalSettingsTab.component.html:121 +msgid "Flatten pasted text into a single line for terminals that do not support multiline paste" +msgstr "" + #: tabby-core/src/services/config.service.ts:428 msgid "Try again" msgstr "" diff --git a/locale/es-ES.po b/locale/es-ES.po index c5fc2069f..17579b096 100644 --- a/locale/es-ES.po +++ b/locale/es-ES.po @@ -1720,6 +1720,14 @@ msgstr "Recordar por {time}" msgid "Remote" msgstr "Remoto" +#: locale/tmp-html/tabby-terminal/src/components/terminalSettingsTab.component.html:120 +msgid "Replace line breaks with spaces" +msgstr "Reemplazar los saltos de línea por espacios" + +#: locale/tmp-html/tabby-terminal/src/components/terminalSettingsTab.component.html:121 +msgid "Flatten pasted text into a single line for terminals that do not support multiline paste" +msgstr "Aplanar el texto pegado en una sola línea para terminales que no admiten pegado multilínea" + #: locale/tmp-html/tabby-terminal/src/components/terminalSettingsTab.component.html:124 msgid "Remove whitespace and newlines around the copied text" msgstr "Eliminar espacios en blanco y nuevas líneas alrededor del texto copiado" diff --git a/tabby-terminal/src/api/baseTerminalTab.component.ts b/tabby-terminal/src/api/baseTerminalTab.component.ts index b91623ef8..e24542599 100644 --- a/tabby-terminal/src/api/baseTerminalTab.component.ts +++ b/tabby-terminal/src/api/baseTerminalTab.component.ts @@ -538,6 +538,10 @@ export class BaseTerminalTabComponent

extends Bas data = data.replaceAll('\n', '\r') } + if (this.config.store.terminal.replaceNewlinesWithSpacesOnPaste) { + data = data.replace(/[\r\n]+/g, ' ') + } + 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) diff --git a/tabby-terminal/src/components/terminalSettingsTab.component.pug b/tabby-terminal/src/components/terminalSettingsTab.component.pug index 9005f12b6..f5fb4ffc3 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) Replace line breaks with spaces + .description(translate) Flatten pasted text into a single line for terminals that do not support multiline paste + toggle( + [(ngModel)]='config.store.terminal.replaceNewlinesWithSpacesOnPaste', + (ngModelChange)='config.save()', + ) + .form-line .header .title(translate) Trim whitespace and newlines diff --git a/tabby-terminal/src/config.ts b/tabby-terminal/src/config.ts index ddbae4869..6cb996a3a 100644 --- a/tabby-terminal/src/config.ts +++ b/tabby-terminal/src/config.ts @@ -52,6 +52,7 @@ export class TerminalConfigProvider extends ConfigProvider { drawBoldTextInBrightColors: true, sixel: true, minimumContrastRatio: 4, + replaceNewlinesWithSpacesOnPaste: false, trimWhitespaceOnPaste: true, }, }