Skip to content

Commit

Permalink
only trim pasted text when it's a single line - fixes #7028, fixes #7064
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Sep 4, 2022
1 parent fbea7db commit 2bf0ef3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tabby-terminal/src/api/baseTerminalTab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,13 +456,12 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
data = data.replaceAll('\n', '\r')
}

if (data.endsWith('\n')) {
if (data.indexOf('\n') === data.length - 1) {
// Ends with a newline and has no other line breaks
data = data.substring(0, data.length - 1)
}

if (!this.alternateScreenActive) {
data = data.trim()

if (data.includes('\r') && this.config.store.terminal.warnOnMultilinePaste) {
const buttons = [
this.translate.instant('Paste'),
Expand All @@ -481,6 +480,8 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
if (result === 1) {
return
}
} else {
data = data.trim()
}
}

Expand Down

0 comments on commit 2bf0ef3

Please sign in to comment.