Merge branch 'underline-dotted' of https://github.com/tisilent/xterm.js into underline-dotted

This commit is contained in:
tisilent
2023-08-23 09:33:20 +08:00
4 changed files with 110 additions and 12 deletions
+97 -10
View File
@@ -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,21 +65,37 @@ 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:
needs: build
test-unit-parallel:
timeout-minutes: 20
strategy:
matrix:
node-version: [16, 18]
node-version: [18]
runs-on: [ubuntu, macos, windows]
runs-on: ${{ matrix.runs-on }}-latest
steps:
- 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
with:
name: build-artifacts
@@ -89,26 +107,68 @@ jobs:
run: 7z x compressed-build.zip -aoa -o${{ github.workspace }}
- name: Print directory structure
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
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}.x
cache: 'yarn'
- 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
run: yarn test-unit --forbid-only
integration-tests:
needs: build
test-api-parallel:
timeout-minutes: 20
strategy:
matrix:
node-version: [18]
runs-on: [ubuntu, windows] # macos is flaky
node-version: [18] # just one as integration tests are about testing in browser
runs-on: [ubuntu] # 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
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
with:
name: build-artifacts
@@ -120,14 +180,41 @@ jobs:
run: 7z x compressed-build.zip -aoa -o${{ github.workspace }}
- name: Print directory structure
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
uses: actions/setup-node@v3
with:
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
- 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 }})
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 { ITerminal } from 'browser/Types';
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 { 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,10 +45,16 @@ 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;
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.register(forwardEvent(this._renderer.onChangeTextureAtlas, this._onChangeTextureAtlas));
this.register(forwardEvent(this._renderer.onAddTextureAtlasCanvas, this._onAddTextureAtlasCanvas));
renderService.setRenderer(this._renderer);
+2 -1
View File
@@ -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",
+3
View File
@@ -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 {