mirror of
https://github.com/Eugeny/tabby.git
synced 2024-11-23 05:03:36 +03:00
automatically trim trailing newline when pasting
This commit is contained in:
parent
924fb90220
commit
ed71b499b9
@ -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 New Issue
Block a user