Skip to content

Commit

Permalink
fixed #7322 - made whitespace trimming on paste optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Oct 25, 2022
1 parent a29a552 commit 7ed7ec3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
8 changes: 4 additions & 4 deletions app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
6 changes: 4 additions & 2 deletions tabby-terminal/src/api/baseTerminalTab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions tabby-terminal/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export class TerminalConfigProvider extends ConfigProvider {
drawBoldTextInBrightColors: true,
sixel: true,
minimumContrastRatio: 4,
trimWhitespaceOnPaste: true,
},
}

Expand Down

0 comments on commit 7ed7ec3

Please sign in to comment.