fixed #7322 - made whitespace trimming on paste optional

This commit is contained in:
Eugene Pankov 2022-10-25 21:36:33 +02:00
parent a29a552afc
commit 7ed7ec3cb4
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
4 changed files with 18 additions and 6 deletions

View File

@ -114,10 +114,10 @@
dependencies: dependencies:
debug "^4.3.2" debug "^4.3.2"
"@tabby-gang/node-pty@^0.11.0-beta.202": "@tabby-gang/node-pty@^0.11.0-beta.203":
version "0.11.0-beta.202" version "0.11.0-beta.204"
resolved "https://registry.yarnpkg.com/@tabby-gang/node-pty/-/node-pty-0.11.0-beta.202.tgz#4d6302f7db226f56de4f01303c9f4abd9a9d7a0f" resolved "https://registry.yarnpkg.com/@tabby-gang/node-pty/-/node-pty-0.11.0-beta.204.tgz#80d4393c7a233d3298f47a4755467a246b0099f9"
integrity sha512-Z/hgI2bjWE6c0nYlCmduNnMVorGgj5868xWX2BxCB0DjsmnMSuO8ktsYjXHIV//JBqIed8TUBdS+x/mQvg/ZUQ== integrity sha512-sNT5Z2MEkEIhToAdVAdZ/lfeQ9UgFE3h2ENlOux+WHBrl1k0BiUEIOd/jh/K3mNAGEfcZ44gNQQ50g5KXTQEmA==
dependencies: dependencies:
nan "^2.16.0" nan "^2.16.0"

View File

@ -462,7 +462,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
data = data.replaceAll('\n', '\r') 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 // Ends with a newline and has no other line breaks
data = data.substring(0, data.length - 1) data = data.substring(0, data.length - 1)
} }
@ -487,7 +487,9 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
return return
} }
} else { } else {
data = data.trim() if (this.config.store.terminal.trimWhitespaceOnPaste) {
data = data.trim()
}
} }
} }

View File

@ -153,6 +153,15 @@ div.mt-4
(ngModelChange)='config.save()', (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 div.mt-4
h3(translate) Sound h3(translate) Sound

View File

@ -70,6 +70,7 @@ export class TerminalConfigProvider extends ConfigProvider {
drawBoldTextInBrightColors: true, drawBoldTextInBrightColors: true,
sixel: true, sixel: true,
minimumContrastRatio: 4, minimumContrastRatio: 4,
trimWhitespaceOnPaste: true,
}, },
} }