Add option to replace line breaks with spaces on paste (#11218)

This commit is contained in:
iroaK
2026-05-07 22:19:00 +02:00
committed by GitHub
parent 4c4b1f04c8
commit 220f7197d9
5 changed files with 30 additions and 0 deletions
+8
View File
@@ -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 ""
+8
View File
@@ -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"
@@ -538,6 +538,10 @@ export class BaseTerminalTabComponent<P extends BaseTerminalProfile> 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)
@@ -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
+1
View File
@@ -52,6 +52,7 @@ export class TerminalConfigProvider extends ConfigProvider {
drawBoldTextInBrightColors: true,
sixel: true,
minimumContrastRatio: 4,
replaceNewlinesWithSpacesOnPaste: false,
trimWhitespaceOnPaste: true,
},
}