fixed automatic resizing with xterm

This commit is contained in:
Eugene Pankov 2019-01-16 15:23:55 +00:00
parent 6a5dc79c5d
commit a64bbe145c

View File

@ -14,7 +14,7 @@ export class XTermFrontend extends Frontend {
xterm: Terminal xterm: Terminal
private configuredFontSize = 0 private configuredFontSize = 0
private zoom = 0 private zoom = 0
private resizeHandler: any private resizeHandler: () => void
private configuredTheme: ITheme = {} private configuredTheme: ITheme = {}
private copyOnSelect = false private copyOnSelect = false
@ -96,6 +96,15 @@ export class XTermFrontend extends Frontend {
} }
configure (config: any): void { configure (config: any): void {
if (this.resizeHandler) {
setTimeout(() => {
try {
this.resizeHandler()
} catch (e) {
// fit() might throw if xterm isn't fully attached yet
}
})
}
this.xterm.setOption('fontFamily', `"${config.terminal.font}", "monospace-fallback", monospace`) this.xterm.setOption('fontFamily', `"${config.terminal.font}", "monospace-fallback", monospace`)
this.xterm.setOption('bellStyle', config.terminal.bell) this.xterm.setOption('bellStyle', config.terminal.bell)
this.xterm.setOption('cursorStyle', { this.xterm.setOption('cursorStyle', {