From 693edab59770ba695e49524f81f96ff139c5f4bd Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sun, 28 Apr 2019 11:41:31 +0200 Subject: [PATCH] prevent recovered tabs from blanking out --- terminus-terminal/package.json | 2 +- terminus-terminal/src/frontends/xtermFrontend.ts | 16 ++++++++-------- terminus-terminal/yarn.lock | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/terminus-terminal/package.json b/terminus-terminal/package.json index 5245292b..ced8f25a 100644 --- a/terminus-terminal/package.json +++ b/terminus-terminal/package.json @@ -28,7 +28,7 @@ "slug": "^0.9.3", "uuid": "^3.3.2", "xterm": "3.10.1", - "xterm-addon-ligatures-tmp": "^0.1.0-beta-1" + "xterm-addon-ligatures": "^0.1.0-beta-2" }, "peerDependencies": { "@angular/common": "4.0.1", diff --git a/terminus-terminal/src/frontends/xtermFrontend.ts b/terminus-terminal/src/frontends/xtermFrontend.ts index 84592421..684da30f 100644 --- a/terminus-terminal/src/frontends/xtermFrontend.ts +++ b/terminus-terminal/src/frontends/xtermFrontend.ts @@ -1,14 +1,11 @@ import { Frontend } from './frontend' import { Terminal, ITheme } from 'xterm' -import * as fit from 'xterm/src/addons/fit/fit' -import * as ligatures from 'xterm-addon-ligatures-tmp' +import { fit } from 'xterm/src/addons/fit/fit' +import { enableLigatures } from 'xterm-addon-ligatures' import 'xterm/lib/xterm.css' import './xterm.css' import deepEqual = require('deep-equal') -Terminal.applyAddon(fit) -Terminal.applyAddon(ligatures) - /** @hidden */ export class XTermFrontend extends Frontend { enableResizing = true @@ -75,7 +72,7 @@ export class XTermFrontend extends Frontend { this.resizeHandler = () => { try { - (this.xterm as any).fit() + fit(this.xterm) } catch { // tends to throw when element wasn't shown yet } @@ -146,11 +143,14 @@ export class XTermFrontend extends Frontend { configure (): void { let config = this.configService.store - setTimeout(() => { + setImmediate(() => { if (this.xterm.cols && this.xterm.rows) { + this.xtermCore.charMeasure.measure(this.xtermCore.options) + this.xtermCore.renderer._updateDimensions() this.resizeHandler() } }) + this.xterm.setOption('fontFamily', `"${config.terminal.font}", "monospace-fallback", monospace`) this.xterm.setOption('bellStyle', config.terminal.bell) this.xterm.setOption('cursorStyle', { @@ -185,7 +185,7 @@ export class XTermFrontend extends Frontend { } if (config.terminal.ligatures && this.xterm.element) { - (this.xterm as any).enableLigatures() + enableLigatures(this.xterm) } } diff --git a/terminus-terminal/yarn.lock b/terminus-terminal/yarn.lock index 7d06e14f..00ecde56 100644 --- a/terminus-terminal/yarn.lock +++ b/terminus-terminal/yarn.lock @@ -253,10 +253,10 @@ windows-process-tree@^0.2.3: dependencies: nan "^2.10.0" -xterm-addon-ligatures-tmp@^0.1.0-beta-1: +xterm-addon-ligatures@^0.1.0-beta-2: version "0.1.0-beta-2" - resolved "https://registry.yarnpkg.com/xterm-addon-ligatures-tmp/-/xterm-addon-ligatures-tmp-0.1.0-beta-2.tgz#1063a282b279b7586372dee7892cea59738c613e" - integrity sha512-d+UoX5dfP7ZSEE/DnQlqubs7Bpw5UxLfTAibpo4pOU2KFw+lRlsLgHg5fcmhXoEvD9rj01enYTsIjedNwnwC5Q== + resolved "https://registry.yarnpkg.com/xterm-addon-ligatures/-/xterm-addon-ligatures-0.1.0-beta-2.tgz#def635fd0ca671fe61179629f8492b76c66dec6e" + integrity sha512-MN5zCBxrF9xagzUYIpcgHS4L/Isod3m3ET5S7AUEEbymLJ+4zccio32eyq65Bcc50x/Bm57Hoh9gaSEUdojs8g== dependencies: font-finder "^1.0.2" font-ligatures "^1.3.1"