made warnOnMultilinePaste optional (fixes #2309)

This commit is contained in:
Eugene Pankov
2020-03-29 01:07:08 +01:00
parent 5d431fa9cf
commit 09d55979ce
3 changed files with 11 additions and 1 deletions

View File

@@ -308,7 +308,7 @@ 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')) { if (!this.alternateScreenActive && data.includes('\r') && this.config.store.terminal.warnOnMultilinePaste) {
const canTrim = !data.trim().includes('\r') const canTrim = !data.trim().includes('\r')
const buttons = canTrim ? ['Paste', 'Trim whitespace and paste', 'Cancel'] : ['Paste', 'Cancel'] const buttons = canTrim ? ['Paste', 'Trim whitespace and paste', 'Cancel'] : ['Paste', 'Cancel']
const result = (await this.electron.showMessageBox( const result = (await this.electron.showMessageBox(

View File

@@ -136,3 +136,12 @@ h3.mb-3 Terminal
[(ngModel)]='config.store.terminal.wordSeparator', [(ngModel)]='config.store.terminal.wordSeparator',
(ngModelChange)='config.save()', (ngModelChange)='config.save()',
) )
.form-line
.header
.title Warn on multi-line paste
.description Show a confirmation box when pasting multiple lines
toggle(
[(ngModel)]='config.store.terminal.warnOnMultilinePaste',
(ngModelChange)='config.save()',
)

View File

@@ -63,6 +63,7 @@ export class TerminalConfigProvider extends ConfigProvider {
profiles: [], profiles: [],
useConPTY: true, useConPTY: true,
recoverTabs: true, recoverTabs: true,
warnOnMultilinePaste: true,
}, },
} }