diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a426746d..c5454e84 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 @@ -63,13 +65,16 @@ 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 run: yarn lint-api unit-tests: + timeout-minutes: 20 strategy: matrix: node-version: [16, 18] @@ -104,9 +109,10 @@ jobs: run: yarn test-unit --forbid-only integration-tests: + timeout-minutes: 20 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 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)); diff --git a/package.json b/package.json index 4fb383fd..be507b6e 100644 --- a/package.json +++ b/package.json @@ -41,8 +41,9 @@ "test-unit-coverage": "node ./bin/test.js --coverage", "test-unit-dev": "cross-env NODE_PATH='./out' mocha", "build": "tsc -b ./tsconfig.all.json", + "install-addons": "node ./bin/install-addons.js", + "presetup": "npm run install-addons", "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", 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 {