From 8af83fef857fe9e9b3c156aff47c50730dae3e80 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 06:00:44 -0700 Subject: [PATCH 1/5] Fix error that can occur when loading canvas addon --- addons/xterm-addon-canvas/src/CanvasAddon.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/xterm-addon-canvas/src/CanvasAddon.ts b/addons/xterm-addon-canvas/src/CanvasAddon.ts index d6136174..2fbec324 100644 --- a/addons/xterm-addon-canvas/src/CanvasAddon.ts +++ b/addons/xterm-addon-canvas/src/CanvasAddon.ts @@ -6,10 +6,11 @@ import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, ISelectionService, IThemeService } from 'browser/services/Services'; import { ITerminal } from 'browser/Types'; import { CanvasRenderer } from './CanvasRenderer'; -import { IBufferService, ICoreService, IDecorationService, IOptionsService } from 'common/services/Services'; +import { IBufferService, ICoreService, IDecorationService, ILogService, IOptionsService } from 'common/services/Services'; import { ITerminalAddon, Terminal } from 'xterm'; import { EventEmitter, forwardEvent } from 'common/EventEmitter'; import { Disposable, toDisposable } from 'common/Lifecycle'; +import { setTraceLogger } from 'common/services/LogService'; export class CanvasAddon extends Disposable implements ITerminalAddon { private _terminal?: Terminal; @@ -44,8 +45,13 @@ export class CanvasAddon extends Disposable implements ITerminalAddon { const charSizeService: ICharSizeService = unsafeCore._charSizeService; const coreBrowserService: ICoreBrowserService = unsafeCore._coreBrowserService; const decorationService: IDecorationService = unsafeCore._decorationService; + const logService: ILogService = unsafeCore._logService; const themeService: IThemeService = unsafeCore._themeService; + // Set trace logger just in case it hasn't been yet which could happen when the addon is + // bundled separately to the core module + setTraceLogger(logService); + this._renderer = new CanvasRenderer(terminal, screenElement, linkifier, bufferService, charSizeService, optionsService, characterJoinerService, coreService, coreBrowserService, decorationService, themeService); this.register(forwardEvent(this._renderer.onChangeTextureAtlas, this._onChangeTextureAtlas)); this.register(forwardEvent(this._renderer.onAddTextureAtlasCanvas, this._onAddTextureAtlasCanvas)); From ee3376593266c73580d5fd066e110b3e6d92c576 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 06:04:33 -0700 Subject: [PATCH 2/5] Move addon install to presetup Fixes #4704 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4fb383fd..df648d55 100644 --- a/package.json +++ b/package.json @@ -41,8 +41,8 @@ "test-unit-coverage": "node ./bin/test.js --coverage", "test-unit-dev": "cross-env NODE_PATH='./out' mocha", "build": "tsc -b ./tsconfig.all.json", + "presetup": "node ./bin/install-addons.js", "setup": "npm run build", - "postinstall": "node ./bin/install-addons.js", "postsetup": "npm run inwasm", "prepublishOnly": "npm run package", "watch": "tsc -b -w ./tsconfig.all.json --preserveWatchOutput", From eae79e93f39da8fa942bba31eb1ca6c5209074c9 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 06:11:54 -0700 Subject: [PATCH 3/5] Install addons in CI --- .github/workflows/ci.yml | 14 ++++++++++---- package.json | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eaf22d67..e16b3571 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,9 @@ jobs: node-version: 18.x cache: 'yarn' - name: Install dependencies - run: yarn --frozen-lockfile + run: | + yarn --frozen-lockfile + yarn install-addons - name: Lint code run: yarn lint - name: Lint API @@ -95,7 +97,9 @@ jobs: node-version: ${{ matrix.node-version }}.x cache: 'yarn' - name: Install dependencies - run: yarn --frozen-lockfile + run: | + yarn --frozen-lockfile + yarn install-addons - name: Unit tests run: yarn test-unit --forbid-only @@ -103,7 +107,7 @@ jobs: needs: build strategy: matrix: - node-version: [18] + node-version: [18] # just one as integration tests are about testing in browser runs-on: [ubuntu, windows] # macos is flaky browser: [chromium, firefox] runs-on: ${{ matrix.runs-on }}-latest @@ -126,7 +130,9 @@ jobs: node-version: ${{ matrix.node-version }}.x cache: 'yarn' - name: Install dependencies - run: yarn --frozen-lockfile + run: | + yarn --frozen-lockfile + yarn install-addons - name: Install playwright run: npx playwright install - name: Integration tests (${{ matrix.browser }}) diff --git a/package.json b/package.json index df648d55..be507b6e 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,8 @@ "test-unit-coverage": "node ./bin/test.js --coverage", "test-unit-dev": "cross-env NODE_PATH='./out' mocha", "build": "tsc -b ./tsconfig.all.json", - "presetup": "node ./bin/install-addons.js", + "install-addons": "node ./bin/install-addons.js", + "presetup": "npm run install-addons", "setup": "npm run build", "postsetup": "npm run inwasm", "prepublishOnly": "npm run package", From dac4dec0ad16608daf49ba54e33f0783f9fa10c4 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 06:13:52 -0700 Subject: [PATCH 4/5] Put reasonable GH action timeouts in place Fixes #4711 --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eaf22d67..240e13c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ on: jobs: build: runs-on: ubuntu-latest + timeout-minutes: 10 steps: - uses: actions/checkout@v3 - name: Use Node.js 18.x @@ -55,6 +56,7 @@ jobs: lint: runs-on: ubuntu-latest + timeout-minutes: 10 steps: - uses: actions/checkout@v3 - name: Use Node.js 18.x @@ -71,6 +73,7 @@ jobs: unit-tests: needs: build + timeout-minutes: 20 strategy: matrix: node-version: [16, 18] @@ -101,6 +104,7 @@ jobs: integration-tests: needs: build + timeout-minutes: 20 strategy: matrix: node-version: [18] From 0e947788e039de72e11843b617110424619e4766 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 22 Aug 2023 06:39:59 -0700 Subject: [PATCH 5/5] Don't smooth scroll when it's a no-op Fixes #4713 --- src/browser/Viewport.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/browser/Viewport.ts b/src/browser/Viewport.ts index 7c1ae945..049bf77c 100644 --- a/src/browser/Viewport.ts +++ b/src/browser/Viewport.ts @@ -279,6 +279,9 @@ export class Viewport extends Disposable implements IViewport { } public scrollLines(disp: number): void { + if (disp === 0) { + return; + } if (!this._optionsService.rawOptions.smoothScrollDuration) { this._onRequestScrollLines.fire({ amount: disp, suppressScrollEvent: false }); } else {