mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-20 19:39:54 +00:00
auto-trim single-line clipboard contents (fixes #2677)
This commit is contained in:
parent
4ab0b51d87
commit
69a0b46a20
@ -308,25 +308,25 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
|||||||
data = data.replace(/\n/g, '\r')
|
data = data.replace(/\n/g, '\r')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.alternateScreenActive && data.includes('\r') && this.config.store.terminal.warnOnMultilinePaste) {
|
if (!this.alternateScreenActive) {
|
||||||
const canTrim = !data.trim().includes('\r')
|
data = data.trim()
|
||||||
const buttons = canTrim ? ['Paste', 'Trim whitespace and paste', 'Cancel'] : ['Paste', 'Cancel']
|
|
||||||
const result = (await this.electron.showMessageBox(
|
if (data.includes('\r') && this.config.store.terminal.warnOnMultilinePaste) {
|
||||||
this.hostApp.getWindow(),
|
const buttons = ['Paste', 'Cancel']
|
||||||
{
|
const result = (await this.electron.showMessageBox(
|
||||||
type: 'warning',
|
this.hostApp.getWindow(),
|
||||||
detail: data,
|
{
|
||||||
message: `Paste multiple lines?`,
|
type: 'warning',
|
||||||
buttons,
|
detail: data,
|
||||||
defaultId: 0,
|
message: `Paste multiple lines?`,
|
||||||
cancelId: buttons.length - 1,
|
buttons,
|
||||||
|
defaultId: 0,
|
||||||
|
cancelId: 1,
|
||||||
|
}
|
||||||
|
)).response
|
||||||
|
if (result === 1) {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
)).response
|
|
||||||
if (result === buttons.length - 1) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (result === 1) {
|
|
||||||
data = data.trim()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.sendInput(data)
|
this.sendInput(data)
|
||||||
|
@ -124,7 +124,7 @@ export class XTermFrontend extends Frontend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.xterm.buffer.onBufferChange(() => {
|
this.xterm.buffer.onBufferChange(() => {
|
||||||
const altBufferActive = this.xterm.buffer.active === this.xterm.buffer.alternate
|
const altBufferActive = this.xterm.buffer.active.type === 'alternate'
|
||||||
this.alternateScreenActive.next(altBufferActive)
|
this.alternateScreenActive.next(altBufferActive)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user