Browse Source

fixed automatic resizing with xterm

Eugene Pankov 6 years ago
parent
commit
a64bbe145c
1 changed files with 10 additions and 1 deletions
  1. 10 1
      terminus-terminal/src/frontends/xtermFrontend.ts

+ 10 - 1
terminus-terminal/src/frontends/xtermFrontend.ts

@@ -14,7 +14,7 @@ export class XTermFrontend extends Frontend {
     xterm: Terminal
     private configuredFontSize = 0
     private zoom = 0
-    private resizeHandler: any
+    private resizeHandler: () => void
     private configuredTheme: ITheme = {}
     private copyOnSelect = false
 
@@ -96,6 +96,15 @@ export class XTermFrontend extends Frontend {
     }
 
     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('bellStyle', config.terminal.bell)
         this.xterm.setOption('cursorStyle', {