Merge branch 'master' into underline-dotted

This commit is contained in:
Daniel Imms
2023-08-22 07:47:42 -07:00
committed by GitHub
4 changed files with 110 additions and 12 deletions
+97 -10
View File
@@ -9,6 +9,7 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Use Node.js 18.x - name: Use Node.js 18.x
@@ -55,6 +56,7 @@ jobs:
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Use Node.js 18.x - name: Use Node.js 18.x
@@ -63,21 +65,37 @@ jobs:
node-version: 18.x node-version: 18.x
cache: 'yarn' cache: 'yarn'
- name: Install dependencies - name: Install dependencies
run: yarn --frozen-lockfile run: |
yarn --frozen-lockfile
yarn install-addons
- name: Lint code - name: Lint code
run: yarn lint run: yarn lint
- name: Lint API - name: Lint API
run: yarn lint-api run: yarn lint-api
unit-tests: test-unit-parallel:
needs: build timeout-minutes: 20
strategy: strategy:
matrix: matrix:
node-version: [16, 18] node-version: [18]
runs-on: [ubuntu, macos, windows] runs-on: [ubuntu, macos, windows]
runs-on: ${{ matrix.runs-on }}-latest runs-on: ${{ matrix.runs-on }}-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}.x
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}.x
cache: 'yarn'
- name: Install dependencies
run: |
yarn --frozen-lockfile
yarn install-addons
- name: Wait for build job
uses: NathanFirmo/wait-for-other-job@v1.1.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
job: build
- uses: actions/download-artifact@v3 - uses: actions/download-artifact@v3
with: with:
name: build-artifacts name: build-artifacts
@@ -89,26 +107,68 @@ jobs:
run: 7z x compressed-build.zip -aoa -o${{ github.workspace }} run: 7z x compressed-build.zip -aoa -o${{ github.workspace }}
- name: Print directory structure - name: Print directory structure
run: ls -R run: ls -R
- name: Unit tests
run: yarn test-unit --forbid-only
test-unit:
needs: build
timeout-minutes: 20
strategy:
matrix:
node-version: [16]
runs-on: [ubuntu, macos, windows]
runs-on: ${{ matrix.runs-on }}-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}.x - name: Use Node.js ${{ matrix.node-version }}.x
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: ${{ matrix.node-version }}.x node-version: ${{ matrix.node-version }}.x
cache: 'yarn' cache: 'yarn'
- name: Install dependencies - name: Install dependencies
run: yarn --frozen-lockfile run: |
yarn --frozen-lockfile
yarn install-addons
- uses: actions/download-artifact@v3
with:
name: build-artifacts
- name: Unzip artifacts (Linux, macOS)
if: runner.os != 'Windows'
run: unzip -o compressed-build.zip
- name: Unzip artifacts (Windows)
if: runner.os == 'Windows'
run: 7z x compressed-build.zip -aoa -o${{ github.workspace }}
- name: Print directory structure
run: ls -R
- name: Unit tests - name: Unit tests
run: yarn test-unit --forbid-only run: yarn test-unit --forbid-only
integration-tests: test-api-parallel:
needs: build timeout-minutes: 20
strategy: strategy:
matrix: matrix:
node-version: [18] node-version: [18] # just one as integration tests are about testing in browser
runs-on: [ubuntu, windows] # macos is flaky runs-on: [ubuntu] # macos is flaky
browser: [chromium, firefox] browser: [chromium, firefox]
runs-on: ${{ matrix.runs-on }}-latest runs-on: ${{ matrix.runs-on }}-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}.x
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}.x
cache: 'yarn'
- name: Install dependencies
run: |
yarn --frozen-lockfile
yarn install-addons
- name: Install playwright
run: npx playwright install
- name: Wait for build job
uses: NathanFirmo/wait-for-other-job@v1.1.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
job: build
- uses: actions/download-artifact@v3 - uses: actions/download-artifact@v3
with: with:
name: build-artifacts name: build-artifacts
@@ -120,14 +180,41 @@ jobs:
run: 7z x compressed-build.zip -aoa -o${{ github.workspace }} run: 7z x compressed-build.zip -aoa -o${{ github.workspace }}
- name: Print directory structure - name: Print directory structure
run: ls -R run: ls -R
- name: Integration tests (${{ matrix.browser }})
run: yarn test-api-${{ matrix.browser }} --headless --forbid-only
test-api:
needs: build
timeout-minutes: 20
strategy:
matrix:
node-version: [18] # just one as integration tests are about testing in browser
runs-on: [windows] # macos is flaky
browser: [chromium, firefox]
runs-on: ${{ matrix.runs-on }}-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}.x - name: Use Node.js ${{ matrix.node-version }}.x
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: ${{ matrix.node-version }}.x node-version: ${{ matrix.node-version }}.x
cache: 'yarn' cache: 'yarn'
- name: Install dependencies - name: Install dependencies
run: yarn --frozen-lockfile run: |
yarn --frozen-lockfile
yarn install-addons
- name: Install playwright - name: Install playwright
run: npx playwright install run: npx playwright install
- uses: actions/download-artifact@v3
with:
name: build-artifacts
- name: Unzip artifacts (Linux, macOS)
if: runner.os != 'Windows'
run: unzip -o compressed-build.zip
- name: Unzip artifacts (Windows)
if: runner.os == 'Windows'
run: 7z x compressed-build.zip -aoa -o${{ github.workspace }}
- name: Print directory structure
run: ls -R
- name: Integration tests (${{ matrix.browser }}) - name: Integration tests (${{ matrix.browser }})
run: yarn test-api-${{ matrix.browser }} --headless --forbid-only run: yarn test-api-${{ matrix.browser }} --headless --forbid-only
+8 -1
View File
@@ -6,10 +6,11 @@
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, ISelectionService, IThemeService } from 'browser/services/Services'; import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, ISelectionService, IThemeService } from 'browser/services/Services';
import { ITerminal } from 'browser/Types'; import { ITerminal } from 'browser/Types';
import { CanvasRenderer } from './CanvasRenderer'; import { CanvasRenderer } from './CanvasRenderer';
import { IBufferService, ICoreService, IDecorationService, IOptionsService, IUnicodeService } from 'common/services/Services'; import { IBufferService, ICoreService, IDecorationService, ILogService, IOptionsService, IUnicodeService } from 'common/services/Services';
import { ITerminalAddon, Terminal } from 'xterm'; import { ITerminalAddon, Terminal } from 'xterm';
import { EventEmitter, forwardEvent } from 'common/EventEmitter'; import { EventEmitter, forwardEvent } from 'common/EventEmitter';
import { Disposable, toDisposable } from 'common/Lifecycle'; import { Disposable, toDisposable } from 'common/Lifecycle';
import { setTraceLogger } from 'common/services/LogService';
export class CanvasAddon extends Disposable implements ITerminalAddon { export class CanvasAddon extends Disposable implements ITerminalAddon {
private _terminal?: Terminal; private _terminal?: Terminal;
@@ -44,10 +45,16 @@ export class CanvasAddon extends Disposable implements ITerminalAddon {
const charSizeService: ICharSizeService = unsafeCore._charSizeService; const charSizeService: ICharSizeService = unsafeCore._charSizeService;
const coreBrowserService: ICoreBrowserService = unsafeCore._coreBrowserService; const coreBrowserService: ICoreBrowserService = unsafeCore._coreBrowserService;
const decorationService: IDecorationService = unsafeCore._decorationService; const decorationService: IDecorationService = unsafeCore._decorationService;
const logService: ILogService = unsafeCore._logService;
const themeService: IThemeService = unsafeCore._themeService; const themeService: IThemeService = unsafeCore._themeService;
const unicodeService: IUnicodeService = unsafeCore.unicodeService; const unicodeService: IUnicodeService = unsafeCore.unicodeService;
// 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, unicodeService); this._renderer = new CanvasRenderer(terminal, screenElement, linkifier, bufferService, charSizeService, optionsService, characterJoinerService, coreService, coreBrowserService, decorationService, themeService, unicodeService);
this.register(forwardEvent(this._renderer.onChangeTextureAtlas, this._onChangeTextureAtlas)); this.register(forwardEvent(this._renderer.onChangeTextureAtlas, this._onChangeTextureAtlas));
this.register(forwardEvent(this._renderer.onAddTextureAtlasCanvas, this._onAddTextureAtlasCanvas)); this.register(forwardEvent(this._renderer.onAddTextureAtlasCanvas, this._onAddTextureAtlasCanvas));
renderService.setRenderer(this._renderer); renderService.setRenderer(this._renderer);
+2 -1
View File
@@ -41,8 +41,9 @@
"test-unit-coverage": "node ./bin/test.js --coverage", "test-unit-coverage": "node ./bin/test.js --coverage",
"test-unit-dev": "cross-env NODE_PATH='./out' mocha", "test-unit-dev": "cross-env NODE_PATH='./out' mocha",
"build": "tsc -b ./tsconfig.all.json", "build": "tsc -b ./tsconfig.all.json",
"install-addons": "node ./bin/install-addons.js",
"presetup": "npm run install-addons",
"setup": "npm run build", "setup": "npm run build",
"postinstall": "node ./bin/install-addons.js",
"postsetup": "npm run inwasm", "postsetup": "npm run inwasm",
"prepublishOnly": "npm run package", "prepublishOnly": "npm run package",
"watch": "tsc -b -w ./tsconfig.all.json --preserveWatchOutput", "watch": "tsc -b -w ./tsconfig.all.json --preserveWatchOutput",
+3
View File
@@ -279,6 +279,9 @@ export class Viewport extends Disposable implements IViewport {
} }
public scrollLines(disp: number): void { public scrollLines(disp: number): void {
if (disp === 0) {
return;
}
if (!this._optionsService.rawOptions.smoothScrollDuration) { if (!this._optionsService.rawOptions.smoothScrollDuration) {
this._onRequestScrollLines.fire({ amount: disp, suppressScrollEvent: false }); this._onRequestScrollLines.fire({ amount: disp, suppressScrollEvent: false });
} else { } else {