mirror of
https://github.com/Eugeny/tabby
synced 2024-11-14 17:07:15 +00:00
automatically trim trailing newline when pasting
This commit is contained in:
parent
924fb90220
commit
ed71b499b9
1 changed files with 8 additions and 3 deletions
|
@ -422,15 +422,16 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
|||
|
||||
async paste (): Promise<void> {
|
||||
let data = this.platform.readClipboard()
|
||||
if (this.config.store.terminal.bracketedPaste && this.frontend?.supportsBracketedPaste()) {
|
||||
data = `\x1b[200~${data}\x1b[201~`
|
||||
}
|
||||
if (this.hostApp.platform === Platform.Windows) {
|
||||
data = data.replaceAll('\r\n', '\r')
|
||||
} else {
|
||||
data = data.replaceAll('\n', '\r')
|
||||
}
|
||||
|
||||
if (data.endsWith('\n')) {
|
||||
data = data.substring(0, data.length - 1)
|
||||
}
|
||||
|
||||
if (!this.alternateScreenActive) {
|
||||
data = data.trim()
|
||||
|
||||
|
@ -451,6 +452,10 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.config.store.terminal.bracketedPaste && this.frontend?.supportsBracketedPaste()) {
|
||||
data = `\x1b[200~${data}\x1b[201~`
|
||||
}
|
||||
this.sendInput(data)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue