bumped xterm, check bracketedPaste state via terminal modes

This commit is contained in:
Eugene Pankov
2021-09-09 23:07:18 +02:00
parent d6fa3b02a9
commit a87d8871ad
6 changed files with 33 additions and 35 deletions

View File

@@ -127,7 +127,6 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
private termContainerSubscriptions = new SubscriptionContainer()
private allFocusModeSubscription: Subscription|null = null
private sessionHandlers = new SubscriptionContainer()
private sessionSupportsBracketedPaste = false
private spinner = new Spinner({
stream: {
write: x => {
@@ -418,19 +417,12 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
}
}
if (data.includes('\x1b[?2004h')) {
this.sessionSupportsBracketedPaste = true
}
if (data.includes('\x1b[?2004l')) {
this.sessionSupportsBracketedPaste = false
}
this.frontend.write(data)
}
async paste (): Promise<void> {
let data = this.platform.readClipboard()
if (this.config.store.terminal.bracketedPaste && this.sessionSupportsBracketedPaste) {
if (this.config.store.terminal.bracketedPaste && this.frontend?.supportsBracketedPaste()) {
data = `\x1b[200~${data}\x1b[201~`
}
if (this.hostApp.platform === Platform.Windows) {

View File

@@ -12,7 +12,7 @@ export class TerminalConfigProvider extends ConfigProvider {
fallbackFont: null,
linePadding: 0,
bell: 'off',
bracketedPaste: false,
bracketedPaste: true,
background: 'theme',
ligatures: false,
cursor: 'block',

View File

@@ -76,4 +76,6 @@ export abstract class Frontend {
abstract saveState (): any
abstract restoreState (state: string): void
abstract supportsBracketedPaste (): boolean
}

View File

@@ -324,6 +324,10 @@ export class XTermFrontend extends Frontend {
this.xterm.write(state)
}
supportsBracketedPaste (): boolean {
return this.xterm.modes.bracketedPasteMode
}
private setFontSize () {
const scale = Math.pow(1.1, this.zoom)
this.xterm.setOption('fontSize', this.configuredFontSize * scale)