Compare commits

..
Author SHA1 Message Date
Cursor AgentandDaniel Imms 511ce3f5d3 Remove unused type imports from common/Types.ts
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 18:43:00 +00:00
Cursor AgentandDaniel Imms cf68f0b514 Restore tsconfig files to match master (undo whitespace-only changes)
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 18:39:14 +00:00
Cursor AgentandDaniel Imms bd8510e3ab Move primitive types from common/Types.ts to common/primitives/Types.ts
Extract low-level types (IParams, ParamsArray, IDisposable, color,
keyboard, mouse, charset, etc.) into primitives/Types.ts. Keep
runtime/integration types (ITerminalOptions, IInputHandler, terminal
modes) in common/Types.ts. Lifecycle re-exports IDisposable from
primitives/Types.ts.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 18:32:48 +00:00
Cursor AgentandDaniel Imms f6c1b21258 Revert esbuild.mjs entry point split for primitives folder
src/common/**/*.ts already covers primitives since they remain under
common/. No build configuration changes are needed for this move.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 18:29:16 +00:00
Cursor AgentandDaniel Imms b7d45bfefa Revert tsconfig path mapping changes for primitives folder
Primitives remain under src/common/, so common/* aliases do not need
a separate primitives entry. Restore original tsconfig paths.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 18:24:02 +00:00
Cursor AgentandDaniel Imms 701c0affd5 Move common primitives to src/common/primitives/
Phase 1 of #5963: reorganize building blocks (buffer, parser, input,
data, and shared utilities) under common/primitives/. Runtime code
(services, public API, CoreTerminal, InputHandler) stays in place.

Update import paths across browser, headless, addons, and tests.
Add TypeScript path mappings so common/* aliases resolve primitives
first, then the common root.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 18:21:03 +00:00
3cdbc77386 fix(addon-search): advance highlight scan by buffer match size (#5994)
* fix(addon-search): advance highlight scan by buffer match size

_highlightAllMatches() stepped to the next find() using term.length
and col + 1 when staying on the same row. Search results expose size
in buffer columns (wide glyphs, wrapped matches), which select() and
decorations already use.

Advance with col + size and wrap row/col when crossing the terminal
width so highlight-all does not skip, duplicate, or stop early on
non-ASCII matches.

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(addon-search): regression for highlight-all wide char advance by size

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>

* test(addon-search): move highlight-all regression to integration tests

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 11:12:04 -07:00
f57b8e1534 Update GitHub Actions to Node 24 compatible versions (#6007)
Upgrade actions/checkout, setup-node, upload-artifact, download-artifact,
and codeql-action to their latest major versions that run on Node 24.

Replace NathanFirmo/wait-for-other-job with native needs: build for
test-unit and test-integration jobs.

Fixes #6006

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 16:58:42 +00:00
c8f11d63b5 fix(terminal): always run clear() at cursor home (#5992)
Remove early return when ybase===0 && y===0 so clear() always
clears markers, resets buffer lines, and refills the viewport.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 16:43:22 +00:00
3d929a1db0 fix(selection): drag-scroll end row and trim start clamp (#5993)
* fix(selection): drag-scroll end row matches last visible line

Use ydisp + rows - 1 for selectionEnd when scrolling down during drag,
consistent with finalSelectionEnd for select-all.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>

* fix(selection): reset start to origin when start row is trimmed

When handleTrim removes the selection start row, clamp to [0,0] and
refresh; do not keep a stale column on row 0.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 16:18:47 +00:00
2fe3fd13a1 fix(addon-webgl): skip missing buffer lines in _updateModel (#5991)
* fix(addon-webgl): skip missing buffer lines in _updateModel

_updateModel force-unwrapped buffer.lines.get(row), which can be
undefined during trim or resize. That threw and left stale glyphs on
rows below the gap.

Clear the WebGL model row and glyph cells, reset blink state, and
continue with remaining viewport rows, matching DomRenderer and
ImageStorage handling.

Co-authored-by: Cursor <cursoragent@cursor.com>

* refactor(addon-webgl): extract _nullModelCell helper

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 09:15:09 -07:00
Daniel ImmsandCursor f33f502267 fix(DomRenderer): resilience when buffer lines are missing (#5998)
* fix(DomRenderer): skip missing buffer lines during row render

renderRows and link underline refresh stopped updating when any
viewport row lacked buffer data, leaving stale DOM on rows below.
Match ImageStorage.render behavior: clear the row element when
present and continue with remaining rows.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(DomRenderer): clear blink state when skipping missing lines

When a viewport row has no buffer line, renderRows clears the row DOM
and continues but did not reset _rowHasBlinkingCells for that row.
That could leave the text blink manager thinking blinking cells remain
after the row was emptied.

Clear blink state for the row when skipping a missing buffer line,
including during link underline refresh.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 09:09:32 -07:00
jerch 7c24c58007 fix non-ascii clipboard handling (#6002)
* fix non-ascii clipboard handling

* rename type helpers

* make linter happy
2026-06-06 09:07:03 -07:00
jerch 596634ac41 fix #6003 (#6004) 2026-06-06 09:02:43 -07:00
jerch 0c8271db49 fix atlas callstack exception (#6001)
* fix atlas callstack exception

* remove spread operator, integrate stress test into demo
2026-06-06 09:01:49 -07:00
Daniel ImmsandCursor f3f4dcaf9f fix(CharacterJoiner): bound join ranges to trimmed line length (#5990)
Character joiner scanning already iterated cells with
getTrimmedLength(), but trailing attribute runs and
_stringRangesToCellRanges used buffer cols. On short lines that
could run joiners on a single trailing cell and extend open ranges
through empty tail columns, affecting ligature/join rendering.

Use trimmed length consistently for trailing-run detection, the
cell-range walk, and the final range end column.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-03 07:05:19 -07:00
64718444e2 fix(webgl): avoid glyph atlas mipmaps (#5987)
Co-authored-by: Will Hampson <whamp@ggl.slmail.me>
Co-authored-by: jerch <jerch@rockborn.de>
2026-06-03 06:00:44 -07:00
181 changed files with 817 additions and 630 deletions
+19 -27
View File
@@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Use Node.js 22.x
uses: actions/setup-node@v3
uses: actions/setup-node@v5
with:
node-version: 22.x
cache: 'npm'
@@ -69,7 +69,7 @@ jobs:
./addons/addon-webgl/out/* \
./addons/addon-webgl/out-*st/*
- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: build-artifacts
path: compressed-build.zip
@@ -79,9 +79,9 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Use Node.js 22.x
uses: actions/setup-node@v3
uses: actions/setup-node@v5
with:
node-version: 22.x
cache: 'npm'
@@ -100,16 +100,16 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Use Node.js 22.x
uses: actions/setup-node@v3
uses: actions/setup-node@v5
with:
node-version: 22.x
cache: 'npm'
- name: Install dependencies
run: |
npm ci
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v7
with:
name: build-artifacts
- name: Unzip artifacts
@@ -129,6 +129,7 @@ jobs:
exit $EXIT_CODE
test-unit:
needs: build
timeout-minutes: 20
strategy:
matrix:
@@ -136,21 +137,16 @@ jobs:
runs-on: [ubuntu, macos, windows]
runs-on: ${{ matrix.runs-on }}-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Use Node.js ${{ matrix.node-version }}.x
uses: actions/setup-node@v3
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}.x
cache: 'npm'
- name: Install dependencies
run: |
npm ci
- 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@v4
- uses: actions/download-artifact@v7
with:
name: build-artifacts
- name: Unzip artifacts
@@ -166,6 +162,7 @@ jobs:
run: npm run test-unit --forbid-only
test-integration:
needs: build
timeout-minutes: 20
strategy:
matrix:
@@ -174,9 +171,9 @@ jobs:
browser: [chromium, firefox, webkit]
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Use Node.js ${{ matrix.node-version }}.x
uses: actions/setup-node@v3
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}.x
cache: 'npm'
@@ -185,12 +182,7 @@ jobs:
npm ci
- name: Install playwright
run: npx playwright install --with-deps ${{ matrix.browser }}
- 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@v4
- uses: actions/download-artifact@v7
with:
name: build-artifacts
- name: Unzip artifacts
@@ -240,9 +232,9 @@ jobs:
matrix:
node-version: [22]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Use Node.js ${{ matrix.node-version }}.x
uses: actions/setup-node@v3
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}.x
cache: 'npm'
@@ -251,7 +243,7 @@ jobs:
npm ci
- name: Install playwright
run: npx playwright install
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v7
with:
name: build-artifacts
- name: Unzip artifacts
+4 -4
View File
@@ -24,12 +24,12 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v5
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v4
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v4
+2 -2
View File
@@ -18,9 +18,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Use Node.js 22.x
uses: actions/setup-node@v3
uses: actions/setup-node@v5
with:
node-version: 22.x
cache: 'npm'
+2 -2
View File
@@ -10,9 +10,9 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Use Node.js 22.x
uses: actions/setup-node@v3
uses: actions/setup-node@v5
with:
node-version: 22.x
cache: 'npm'
+32 -2
View File
@@ -78,13 +78,43 @@ export class BrowserClipboardProvider implements IClipboardProvider {
}
}
/**
* TODO: Once the base64 handling on Uint8Arrays is more common,
* remove the btoa/atob fallbacks below.
*/
interface IUint8ArrayB64 extends Uint8Array {
toBase64(): string;
}
interface IUint8ArrayB64Ctor extends Uint8ArrayConstructor {
fromBase64(s: string): IUint8ArrayB64;
}
export class Base64 implements IBase64 {
public encodeText(data: string): string {
return btoa(data);
const bytes = new TextEncoder().encode(data) as IUint8ArrayB64;
if (bytes.toBase64 !== undefined) {
return bytes.toBase64();
}
let bin = '';
for (let i = 0; i < bytes.length; i++) {
bin += String.fromCharCode(bytes[i]);
}
return btoa(bin);
}
public decodeText(data: string): string {
if ((Uint8Array as IUint8ArrayB64Ctor).fromBase64 !== undefined) {
try {
return new TextDecoder().decode((Uint8Array as IUint8ArrayB64Ctor).fromBase64(data));
} catch {}
return '';
}
try {
return atob(data);
const bin = atob(data);
const bytes = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
bytes[i] = bin.charCodeAt(i);
}
return new TextDecoder().decode(bytes);
} catch {}
return '';
}
@@ -29,7 +29,7 @@ test.describe('ClipboardAddon', () => {
await ctx.page.context().grantPermissions(['clipboard-read', 'clipboard-write']);
}
await ctx.page.evaluate(`
window.term.reset()
window.term.reset();
window.clipboard?.dispose();
window.clipboard = new ClipboardAddon();
window.term.loadAddon(window.clipboard);
@@ -92,4 +92,22 @@ test.describe('ClipboardAddon', () => {
deepEqual(await ctx.page.evaluate(() => window.navigator.clipboard.readText()), '');
});
});
test.describe('non-ASCII', () => {
const testDataEncoded = '4oKsbWzDpMO8dMOf';
const testDataDecoded = '€mläütß';
test('write simple string', async () => {
await ctx.proxy.write(`\x1b]52;c;${testDataEncoded}\x07`);
deepEqual(await ctx.page.evaluate(() => window.navigator.clipboard.readText()), testDataDecoded);
});
test('read simple string', async () => {
await ctx.page.evaluate(`
window.data2 = [];
window.term.onData(e => data2.push(e));
`);
await ctx.page.evaluate((d) => window.navigator.clipboard.writeText(d), testDataDecoded);
await ctx.proxy.write(`\x1b]52;c;?\x07`);
deepEqual(await ctx.page.evaluate('window.data2'), [`\x1b]52;c;${testDataEncoded}\x07`]);
});
});
});
+1 -1
View File
@@ -5,7 +5,7 @@
import type { ITerminalAddon, IDisposable } from '@xterm/xterm';
import type { ImageAddon as IImageApi } from '@xterm/addon-image';
import { Emitter, type IEvent } from 'common/Event';
import { Emitter, type IEvent } from 'common/primitives/Event';
import { IIPHandler } from './IIPHandler';
import { ImageRenderer } from './ImageRenderer';
import { ImageStorage, CELL_SIZE_DEFAULT } from './ImageStorage';
+1 -1
View File
@@ -6,7 +6,7 @@
import { toRGBA8888 } from 'sixel/lib/Colors';
import { IDisposable } from '@xterm/xterm';
import { ICellSize, ImageLayer, ITerminalExt, IImageSpec, IRenderDimensions, IRenderService } from './Types';
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
import { Disposable, MutableDisposable, toDisposable } from 'common/primitives/Lifecycle';
const enum Constants {
PLACEHOLDER_LENGTH = 4096,
+4 -4
View File
@@ -6,11 +6,11 @@
import { IDisposable, IMarker, Terminal } from '@xterm/xterm';
// private imports from base repo we build against
import { Attributes, BgFlags, Content, ExtFlags, UnderlineStyle } from 'common/buffer/Constants';
import type { AttributeData } from 'common/buffer/AttributeData';
import type { IParams, IDcsHandler, IOscHandler, IApcHandler, IEscapeSequenceParser } from 'common/parser/Types';
import { Attributes, BgFlags, Content, ExtFlags, UnderlineStyle } from 'common/primitives/buffer/Constants';
import type { AttributeData } from 'common/primitives/buffer/AttributeData';
import type { IParams, IDcsHandler, IOscHandler, IApcHandler, IEscapeSequenceParser } from 'common/primitives/parser/Types';
import type { IInputHandler } from 'common/Types';
import type { IBufferLine, IExtendedAttrs } from 'common/buffer/Types';
import type { IBufferLine, IExtendedAttrs } from 'common/primitives/buffer/Types';
import type { ITerminal, ReadonlyColorSet } from 'browser/Types';
import type { IRenderDimensions } from 'browser/renderer/shared/Types';
import type { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
+1 -1
View File
@@ -5,7 +5,7 @@
import type { Terminal, ITerminalAddon, IDisposable } from '@xterm/xterm';
import type { ProgressAddon as IProgressApi, IProgressState } from '@xterm/addon-progress';
import type { Emitter, IEvent } from 'common/Event';
import type { Emitter, IEvent } from 'common/primitives/Event';
const enum ProgressType {
@@ -10,7 +10,7 @@ import { SearchLineCache } from './SearchLineCache';
import { Terminal } from 'browser/public/Terminal';
import type { ISearchDecorationOptions } from '@xterm/addon-search';
import type { IDecorationOptions } from '@xterm/xterm';
import { DisposableStore } from 'common/Lifecycle';
import { DisposableStore } from 'common/primitives/Lifecycle';
function writeP(terminal: Terminal, data: string): Promise<void> {
return new Promise(r => terminal.write(data, r));
+1 -1
View File
@@ -5,7 +5,7 @@
import type { Terminal, IDisposable, IDecoration } from '@xterm/xterm';
import type { ISearchDecorationOptions } from '@xterm/addon-search';
import { dispose, Disposable, toDisposable } from 'common/Lifecycle';
import { dispose, Disposable, toDisposable } from 'common/primitives/Lifecycle';
import type { ISearchResult } from './SearchEngine';
/**
+11 -9
View File
@@ -5,9 +5,9 @@
import type { Terminal, IDisposable, ITerminalAddon } from '@xterm/xterm';
import type { SearchAddon as ISearchApi, ISearchOptions, ISearchAddonOptions, ISearchResultChangeEvent, ISearchDecorationOptions } from '@xterm/addon-search';
import { Emitter, type IEvent } from 'common/Event';
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
import { disposableTimeout } from 'common/Async';
import { Emitter, type IEvent } from 'common/primitives/Event';
import { Disposable, MutableDisposable, toDisposable } from 'common/primitives/Lifecycle';
import { disposableTimeout } from 'common/primitives/Async';
import { SearchLineCache } from './SearchLineCache';
import { SearchState } from './SearchState';
import { SearchEngine, type ISearchResult } from './SearchEngine';
@@ -142,12 +142,14 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
}
prevResult = result;
results.push(prevResult);
result = this._engine.find(
term,
prevResult.col + prevResult.term.length >= this._terminal.cols ? prevResult.row + 1 : prevResult.row,
prevResult.col + prevResult.term.length >= this._terminal.cols ? 0 : prevResult.col + 1,
searchOptions
);
const cols = this._terminal.cols;
let nextCol = prevResult.col + prevResult.size;
let nextRow = prevResult.row;
if (nextCol >= cols) {
nextRow += Math.floor(nextCol / cols);
nextCol = nextCol % cols;
}
result = this._engine.find(term, nextRow, nextCol, searchOptions);
}
this._resultTracker.updateResults(results, this._highlightLimit);
+1 -1
View File
@@ -7,7 +7,7 @@ import { SearchEngine } from './SearchEngine';
import { SearchLineCache } from './SearchLineCache';
import { Terminal } from 'browser/public/Terminal';
import type { ISearchOptions } from '@xterm/addon-search';
import { DisposableStore } from 'common/Lifecycle';
import { DisposableStore } from 'common/primitives/Lifecycle';
function writeP(terminal: Terminal, data: string): Promise<void> {
return new Promise(r => terminal.write(data, r));
@@ -5,7 +5,7 @@
import { assert } from 'chai';
import { SearchLineCache, LineCacheEntry } from './SearchLineCache';
import { Terminal } from 'browser/public/Terminal';
import { timeout } from 'common/Async';
import { timeout } from 'common/primitives/Async';
function writeP(terminal: Terminal, data: string): Promise<void> {
return new Promise(r => terminal.write(data, r));
+2 -2
View File
@@ -4,8 +4,8 @@
*/
import type { Terminal } from '@xterm/xterm';
import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
import { disposableTimeout } from 'common/Async';
import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from 'common/primitives/Lifecycle';
import { disposableTimeout } from 'common/primitives/Async';
export type LineCacheEntry = [
/**
@@ -5,8 +5,8 @@
import type { ISearchResultChangeEvent } from '@xterm/addon-search';
import type { IDisposable } from '@xterm/xterm';
import { Emitter, type IEvent } from 'common/Event';
import { Disposable } from 'common/Lifecycle';
import { Emitter, type IEvent } from 'common/primitives/Event';
import { Disposable } from 'common/primitives/Lifecycle';
import type { ISearchResult } from './SearchEngine';
/**
@@ -414,6 +414,20 @@ test.describe('Search Tests', () => {
});
test.describe('Regression tests', () => {
test('should advance highlight-all scan by buffer match size for wide characters', async () => {
await ctx.page.evaluate(`
window.calls = [];
window.search.onDidChangeResults(e => window.calls.push(e));
`);
await ctx.proxy.resize(3, 5);
await ctx.proxy.write('𝄞𝄞𝄞');
strictEqual(await ctx.page.evaluate(`window.search.findNext('𝄞', { decorations: { activeMatchColorOverviewRuler: '#ff0000', matchOverviewRuler: '#ffff00' } })`), true);
deepStrictEqual(await ctx.page.evaluate('window.calls'), [
{ resultCount: 3, resultIndex: 0 }
]);
await ctx.proxy.resize(80, 24);
});
test.describe('#2444 wrapped line content not being found', () => {
let fixture: string;
test.beforeAll(async () => {
@@ -6,7 +6,7 @@
import { perfContext, before, ThroughputRuntimeCase } from 'xterm-benchmark';
import { spawn } from 'node-pty';
import { Utf8ToUtf32, stringFromCodePoint } from 'common/input/TextDecoder';
import { Utf8ToUtf32, stringFromCodePoint } from 'common/primitives/input/TextDecoder';
import { Terminal } from 'browser/public/Terminal';
import { SerializeAddon } from 'SerializeAddon';
+3 -3
View File
@@ -7,10 +7,10 @@
import type { IBuffer, IBufferCell, IBufferRange, ITerminalAddon, Terminal } from '@xterm/xterm';
import type { IHTMLSerializeOptions, SerializeAddon as ISerializeApi, ISerializeOptions, ISerializeRange } from '@xterm/addon-serialize';
import { IColor } from 'common/Types';
import { IAttributeData } from 'common/buffer/Types';
import { IColor } from 'common/primitives/Types';
import { IAttributeData } from 'common/primitives/buffer/Types';
import { DEFAULT_ANSI_COLORS } from 'browser/Types';
import { UnderlineStyle } from 'common/buffer/Constants';
import { UnderlineStyle } from 'common/primitives/buffer/Constants';
function constrain(value: number, low: number, high: number): number {
return Math.max(low, Math.min(value, high));
@@ -6,7 +6,7 @@
import { perfContext, before, ThroughputRuntimeCase } from 'xterm-benchmark';
import { spawn } from 'node-pty';
import { Utf8ToUtf32, stringFromCodePoint } from 'common/input/TextDecoder';
import { Utf8ToUtf32, stringFromCodePoint } from 'common/primitives/input/TextDecoder';
import { CoreBrowserTerminal } from 'browser/CoreBrowserTerminal';
import { UnicodeGraphemeProvider } from 'UnicodeGraphemeProvider';
+3 -3
View File
@@ -1,11 +1,11 @@
import { ISelectionRenderModel } from 'browser/renderer/shared/Types';
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { ReadonlyColorSet } from 'browser/Types';
import { Attributes, BgFlags, ExtFlags, FgFlags, NULL_CELL_CODE, UnderlineStyle } from 'common/buffer/Constants';
import { Attributes, BgFlags, ExtFlags, FgFlags, NULL_CELL_CODE, UnderlineStyle } from 'common/primitives/buffer/Constants';
import { IDecorationService, IOptionsService } from 'common/services/Services';
import { ICellData } from 'common/buffer/Types';
import { ICellData } from 'common/primitives/buffer/Types';
import { Terminal } from '@xterm/xterm';
import { rgba } from 'common/Color';
import { rgba } from 'common/primitives/Color';
import { treatGlyphAsBackgroundColor } from 'browser/renderer/shared/RendererUtils';
import { blockPatternCodepoints } from './customGlyphs/CustomGlyphDefinitions';
@@ -6,8 +6,8 @@
import { assert } from 'chai';
import { configEquals } from './CharAtlasUtils';
import { ICharAtlasConfig } from './Types';
import { NULL_COLOR } from 'common/Color';
import { IColor } from 'common/Types';
import { NULL_COLOR } from 'common/primitives/Color';
import { IColor } from 'common/primitives/Types';
function createTestConfig(overrides: Partial<ICharAtlasConfig> = {}): ICharAtlasConfig {
const color: IColor = { css: '#ffffff', rgba: 0xffffffff };
+2 -2
View File
@@ -4,10 +4,10 @@
*/
import { ICharAtlasConfig } from './Types';
import { Attributes } from 'common/buffer/Constants';
import { Attributes } from 'common/primitives/buffer/Constants';
import { ITerminalOptions } from '@xterm/xterm';
import { IColorSet, ReadonlyColorSet } from 'browser/Types';
import { NULL_COLOR } from 'common/Color';
import { NULL_COLOR } from 'common/primitives/Color';
export function generateConfig(deviceCellWidth: number, deviceCellHeight: number, deviceCharWidth: number, deviceCharHeight: number, options: Required<ITerminalOptions>, colors: ReadonlyColorSet, devicePixelRatio: number, deviceMaxTextureSize: number, customGlyphs: boolean = true): ICharAtlasConfig {
// null out some fields that don't matter
+1 -1
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { isFirefox, isLegacyEdge } from 'common/Platform';
import { isFirefox, isLegacyEdge } from 'common/primitives/Platform';
export const DIM_OPACITY = 0.5;
// The text baseline is set conditionally by browser. Using 'ideographic' for Firefox or Legacy Edge
@@ -3,7 +3,7 @@
* @license MIT
*/
import { toDisposable, IDisposable } from 'common/Lifecycle';
import { toDisposable, IDisposable } from 'common/primitives/Lifecycle';
export function observeDevicePixelDimensions(element: HTMLElement, parentWindow: Window & typeof globalThis, callback: (deviceWidth: number, deviceHeight: number) => void): IDisposable {
// Observe any resizes to the element and extract the actual pixel size of the element if the
+4 -3
View File
@@ -4,8 +4,8 @@
*/
import { TextureAtlas } from './TextureAtlas';
import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { NULL_CELL_CODE } from 'common/buffer/Constants';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { NULL_CELL_CODE } from 'common/primitives/buffer/Constants';
import { Disposable, toDisposable } from 'common/primitives/Lifecycle';
import { Terminal } from '@xterm/xterm';
import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject, type IRasterizedGlyph, type ITextureAtlas } from './Types';
import { createProgram, GLTexture, PROJECTION_MATRIX } from './WebglUtils';
@@ -389,8 +389,9 @@ export class GlyphRenderer extends Disposable {
gl.bindTexture(gl.TEXTURE_2D, this._atlasTextures[i].texture);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, atlas.pages[i].canvas);
gl.generateMipmap(gl.TEXTURE_2D);
this._atlasTextures[i].version = atlas.pages[i].version;
}
+3 -3
View File
@@ -6,9 +6,9 @@
import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { IThemeService } from 'browser/services/Services';
import { ReadonlyColorSet } from 'browser/Types';
import { Attributes, FgFlags } from 'common/buffer/Constants';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { IColor } from 'common/Types';
import { Attributes, FgFlags } from 'common/primitives/buffer/Constants';
import { Disposable, toDisposable } from 'common/primitives/Lifecycle';
import { IColor } from 'common/primitives/Types';
import { Terminal } from '@xterm/xterm';
import { RenderModelConstants } from './RenderModel';
import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject } from './Types';
+29 -13
View File
@@ -8,14 +8,14 @@ import { DIM_OPACITY, TEXT_BASELINE } from './Constants';
import { tryDrawCustomGlyph } from './customGlyphs/CustomGlyphRasterizer';
import { computeNextVariantOffset, treatGlyphAsBackgroundColor, isPowerlineGlyph, isRestrictedPowerlineGlyph, throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
import { IBoundingBox, ICharAtlasConfig, IRasterizedGlyph, ITextureAtlas } from './Types';
import { NULL_COLOR, channels, color, rgba } from 'common/Color';
import { FourKeyMap } from 'common/MultiKeyMap';
import { IdleTaskQueue } from 'common/TaskQueue';
import { IColor } from 'common/Types';
import { AttributeData } from 'common/buffer/AttributeData';
import { Attributes, DEFAULT_COLOR, DEFAULT_EXT, UnderlineStyle } from 'common/buffer/Constants';
import { NULL_COLOR, channels, color, rgba } from 'common/primitives/Color';
import { FourKeyMap } from 'common/primitives/MultiKeyMap';
import { IdleTaskQueue } from 'common/primitives/TaskQueue';
import { IColor } from 'common/primitives/Types';
import { AttributeData } from 'common/primitives/buffer/AttributeData';
import { Attributes, DEFAULT_COLOR, DEFAULT_EXT, UnderlineStyle } from 'common/primitives/buffer/Constants';
import { ILogService, IUnicodeService } from 'common/services/Services';
import { Emitter } from 'common/Event';
import { Emitter } from 'common/primitives/Event';
/**
* A shared object which is used to draw nothing for a particular cell.
@@ -1080,17 +1080,33 @@ class AtlasPage {
size: number,
sourcePages?: AtlasPage[]
) {
if (sourcePages) {
for (const p of sourcePages) {
this._glyphs.push(...p.glyphs);
this._usedPixels += p._usedPixels;
}
}
this.canvas = createCanvas(document, size, size);
// The canvas needs alpha because we use clearColor to convert the background color to alpha.
// It might also contain some characters with transparent backgrounds if allowTransparency is
// set.
this.ctx = throwIfFalsy(this.canvas.getContext('2d', { alpha: true }));
if (sourcePages) {
if (sourcePages.length === 4) {
// optimized for quadmerge
this._glyphs = this._glyphs.concat(
sourcePages[0].glyphs,
sourcePages[1].glyphs,
sourcePages[2].glyphs,
sourcePages[3].glyphs
);
this._usedPixels = sourcePages[0]._usedPixels +
sourcePages[1]._usedPixels +
sourcePages[2]._usedPixels +
sourcePages[3]._usedPixels;
} else {
// fallback for non quadmerges (should never be used)
for (let i = 0; i < sourcePages.length; ++i) {
this._glyphs = this._glyphs.concat(sourcePages[i].glyphs);
this._usedPixels += sourcePages[i]._usedPixels;
}
}
}
}
public clear(): void {
+2 -2
View File
@@ -6,8 +6,8 @@
import { FontWeight } from '@xterm/xterm';
import { IColorSet } from 'browser/Types';
import { ISelectionRenderModel } from 'browser/renderer/shared/Types';
import { CursorInactiveStyle, CursorStyle, type IDisposable } from 'common/Types';
import type { IEvent } from 'common/Event';
import { CursorInactiveStyle, CursorStyle, type IDisposable } from 'common/primitives/Types';
import type { IEvent } from 'common/primitives/Event';
export interface IRenderModel {
cells: Uint32Array;
+3 -3
View File
@@ -7,12 +7,12 @@ import type { ITerminalAddon, Terminal } from '@xterm/xterm';
import type { IWebglAddonOptions, WebglAddon as IWebglApi } from '@xterm/addon-webgl';
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
import { ITerminal } from 'browser/Types';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { getSafariVersion, isSafari } from 'common/Platform';
import { Disposable, toDisposable } from 'common/primitives/Lifecycle';
import { getSafariVersion, isSafari } from 'common/primitives/Platform';
import { ICoreService, IDecorationService, ILogService, IOptionsService } from 'common/services/Services';
import { IWebGL2RenderingContext } from './Types';
import { WebglRenderer } from './WebglRenderer';
import { Emitter, EventUtils } from 'common/Event';
import { Emitter, EventUtils } from 'common/primitives/Event';
export class WebglAddon extends Disposable implements ITerminalAddon, IWebglApi {
private _terminal?: Terminal;
+27 -12
View File
@@ -10,10 +10,10 @@ import { CursorBlinkStateManager } from './CursorBlinkStateManager';
import { observeDevicePixelDimensions } from './DevicePixelObserver';
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/shared/Types';
import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { CharData, IBufferLine, ICellData } from 'common/buffer/Types';
import { AttributeData } from 'common/buffer/AttributeData';
import { CellData } from 'common/buffer/CellData';
import { Attributes, Content, FgFlags, NULL_CELL_CHAR, NULL_CELL_CODE } from 'common/buffer/Constants';
import { CharData, IBufferLine, ICellData } from 'common/primitives/buffer/Types';
import { AttributeData } from 'common/primitives/buffer/AttributeData';
import { CellData } from 'common/primitives/buffer/CellData';
import { Attributes, Content, FgFlags, NULL_CELL_CHAR, NULL_CELL_CODE } from 'common/primitives/buffer/Constants';
import { TextBlinkStateManager } from 'browser/renderer/shared/TextBlinkStateManager';
import { ICoreService, IDecorationService, ILogService, IOptionsService } from 'common/services/Services';
import { Terminal } from '@xterm/xterm';
@@ -23,9 +23,9 @@ import { COMBINED_CHAR_BIT_MASK, RenderModel, RenderModelConstants } from './Ren
import { IWebGL2RenderingContext, type ITextureAtlas } from './Types';
import { LinkRenderLayer } from './renderLayer/LinkRenderLayer';
import { IRenderLayer } from './renderLayer/Types';
import { Emitter, EventUtils } from 'common/Event';
import { Emitter, EventUtils } from 'common/primitives/Event';
import { addDisposableListener } from 'browser/Dom';
import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from 'common/primitives/Lifecycle';
import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
const enum Constants {
@@ -456,7 +456,18 @@ export class WebglRenderer extends Disposable implements IRenderer {
for (y = start; y <= end; y++) {
row = y + terminal.buffer.ydisp;
line = terminal.buffer.lines.get(row)!;
const bufferLine = terminal.buffer.lines.get(row);
if (!bufferLine) {
this._model.lineLengths[y] = 0;
for (x = 0; x < terminal.cols; x++) {
j = ((y * terminal.cols) + x) * RenderModelConstants.INDICIES_PER_CELL;
modelUpdated = true;
this._nullModelCell(x, y, j, 0, 0, 0);
}
this._setRowBlinkState(y, false);
continue;
}
line = bufferLine;
let rowHasBlinkingCells = false;
this._model.lineLengths[y] = 0;
isCursorRow = cursorY === row;
@@ -587,13 +598,9 @@ export class WebglRenderer extends Disposable implements IRenderer {
// Null out non-first cells
for (x++; x <= lastCharX; x++) {
j = ((y * terminal.cols) + x) * RenderModelConstants.INDICIES_PER_CELL;
this._glyphRenderer.value!.updateCell(x, y, NULL_CELL_CODE, 0, 0, 0, NULL_CELL_CHAR, 0, 0);
this._model.cells[j] = NULL_CELL_CODE;
// Don't re-resolve the cell color since multi-colored ligature backgrounds are not
// supported
this._model.cells[j + RenderModelConstants.BG_OFFSET] = this._cellColorResolver.result.bg;
this._model.cells[j + RenderModelConstants.FG_OFFSET] = this._cellColorResolver.result.fg;
this._model.cells[j + RenderModelConstants.EXT_OFFSET] = this._cellColorResolver.result.ext;
this._nullModelCell(x, y, j, this._cellColorResolver.result.bg, this._cellColorResolver.result.fg, this._cellColorResolver.result.ext);
}
x--; // Go back to the previous update cell for next iteration
}
@@ -607,6 +614,14 @@ export class WebglRenderer extends Disposable implements IRenderer {
this._updateTextBlinkState();
}
private _nullModelCell(x: number, y: number, cellIndex: number, bg: number, fg: number, ext: number): void {
this._glyphRenderer.value!.updateCell(x, y, NULL_CELL_CODE, bg, fg, ext, NULL_CELL_CHAR, 0, 0);
this._model.cells[cellIndex] = NULL_CELL_CODE;
this._model.cells[cellIndex + RenderModelConstants.BG_OFFSET] = bg;
this._model.cells[cellIndex + RenderModelConstants.FG_OFFSET] = fg;
this._model.cells[cellIndex + RenderModelConstants.EXT_OFFSET] = ext;
}
private _resetBlinkingRowState(): void {
this._rowHasBlinkingCells = new Array(this._terminal.rows).fill(false);
this._rowHasBlinkingCellsCount = 0;
@@ -7,8 +7,8 @@ import { ReadonlyColorSet } from 'browser/Types';
import { acquireTextureAtlas } from '../CharAtlasCache';
import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { CellData } from 'common/buffer/CellData';
import { Disposable, toDisposable } from 'common/primitives/Lifecycle';
import { CellData } from 'common/primitives/buffer/CellData';
import { IOptionsService } from 'common/services/Services';
import { Terminal } from '@xterm/xterm';
import { IRenderLayer } from './Types';
@@ -7,7 +7,7 @@ import { BaseWindow } from './baseWindow';
import type { IControlWindow } from '../controlBar';
import type { IBufferCell } from '@xterm/xterm';
// Underline style values from common/buffer/Constants.ts
// Underline style values from common/primitives/buffer/Constants.ts
const enum UnderlineStyle {
NONE = 0,
SINGLE = 1,
@@ -11,8 +11,33 @@ export class WebglWindow extends BaseWindow implements IControlWindow {
public readonly label = 'webgl';
private _textureAtlasContainer!: HTMLElement;
private _stressRunning = false;
private _stressScrolling: HTMLInputElement | undefined;
public build(container: HTMLElement): void {
const stressDiv = document.createElement('div');
const stressStart = document.createElement('button');
stressStart.id = 'stress-start';
stressStart.textContent = 'atlas stress start';
stressStart.addEventListener('click', () => this._stress());
stressDiv.appendChild(stressStart);
const stressStop = document.createElement('button');
stressStop.id = 'stress-stop';
stressStop.textContent = 'atlas stress stop';
stressStop.addEventListener('click', () => this._stressRunning = false);
stressDiv.appendChild(stressStop);
this._stressScrolling = document.createElement('input');
this._stressScrolling.type = 'checkbox';
this._stressScrolling.id = 'stress-scrolling';
stressDiv.appendChild(this._stressScrolling);
const stressScrollingLabel = document.createElement('label');
stressScrollingLabel.htmlFor = 'stress-scrolling';
stressScrollingLabel.textContent = 'stress scrolling';
stressDiv.appendChild(stressScrollingLabel);
container.appendChild(stressDiv);
const zoomCheckbox = document.createElement('input');
zoomCheckbox.type = 'checkbox';
zoomCheckbox.id = 'texture-atlas-zoom';
@@ -48,4 +73,33 @@ export class WebglWindow extends BaseWindow implements IControlWindow {
canvas.style.width = `${canvas.width / dpr}px`;
canvas.style.height = `${canvas.height / dpr}px`;
}
private async _stress(): Promise<void> {
const TEXT = '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
if (this._stressRunning) {
return;
}
this._stressRunning = true;
const scrolling = !!(this._stressScrolling?.checked);
for (let r = 0; r < 256; r += 2) {
for (let g = 0; g < 256; g += 2) {
let s: string[] = [];
for (let b = 0; b < 256; b += 2) {
if (!this._stressRunning) {
return;
}
const rbg = `RGB: ${[r, g, b]}`;
s.push(`\r\x1b[38;2;${r};${g};${b}m${rbg.padEnd(18, ' ')}${TEXT}`);
if (s.length >= 16) {
if (scrolling) {
await new Promise<void>(r => this._terminal.write(s.join('\r\n') + '\r\n', r));
} else {
await new Promise<void>(r => this._terminal.write('\x1b[H' + s.join('\r\n'), r));
}
s = [];
}
}
}
}
}
}
+5 -8
View File
@@ -8043,17 +8043,14 @@
}
},
"node_modules/uuid": {
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.1.tgz",
"integrity": "sha512-vIYxrBCC/N/K+Js3qSN88go7kIfNPssr/hHCesKCQNAjmgvYS2oqr69kIufEG+O4+PfezOH4EbIeHCfFov8ZgQ==",
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"deprecated": "uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).",
"dev": true,
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"license": "MIT",
"bin": {
"uuid": "dist/esm/bin/uuid"
"uuid": "dist/bin/uuid"
}
},
"node_modules/vary": {
+1 -2
View File
@@ -12,8 +12,7 @@
"addons/*"
],
"overrides": {
"serialize-javascript": "^7.0.3",
"uuid": "^11.1.1"
"serialize-javascript": "^7.0.3"
},
"keywords": [
"cli",
+2 -2
View File
@@ -6,9 +6,9 @@
import * as Strings from './LocalizableStrings';
import { ITerminal, IRenderDebouncer } from './Types';
import { TimeBasedDebouncer } from './TimeBasedDebouncer';
import { Disposable, toDisposable } from '../common/Lifecycle';
import { Disposable, toDisposable } from '../common/primitives/Lifecycle';
import { ICoreBrowserService, IRenderService } from './services/Services';
import { IBuffer } from '../common/buffer/Types';
import { IBuffer } from '../common/primitives/buffer/Types';
import { IInstantiationService } from '../common/services/Services';
import { addDisposableListener } from './Dom';
+2 -2
View File
@@ -4,8 +4,8 @@
*/
import { IColorContrastCache } from './Types';
import { IColor } from '../common/Types';
import { TwoKeyMap } from '../common/MultiKeyMap';
import { IColor } from '../common/primitives/Types';
import { TwoKeyMap } from '../common/primitives/MultiKeyMap';
export class ColorContrastCache implements IColorContrastCache {
private _color: TwoKeyMap</* bg */number, /* fg */number, IColor | null> = new TwoKeyMap();
+10 -13
View File
@@ -43,22 +43,23 @@ import { SelectionService } from './services/SelectionService';
import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IKeyboardService, ILinkProviderService, IMouseCoordsService, IMouseService, IRenderService, ISelectionService, IThemeService } from './services/Services';
import { ThemeService } from './services/ThemeService';
import { KeyboardService } from './services/KeyboardService';
import { channels, color, rgb } from '../common/Color';
import { channels, color, rgb } from '../common/primitives/Color';
import { CoreTerminal } from '../common/CoreTerminal';
import * as Browser from '../common/Platform';
import { ColorRequestType, IColorEvent, ITerminalOptions, KeyboardResultType, SpecialColorIndex } from '../common/Types';
import { DEFAULT_ATTR_DATA } from '../common/buffer/BufferLine';
import { IBuffer } from '../common/buffer/Types';
import { C0, C1ESCAPED } from '../common/data/EscapeSequences';
import { toRgbString } from '../common/input/XParseColor';
import * as Browser from '../common/primitives/Platform';
import { ColorRequestType, IColorEvent, KeyboardResultType, SpecialColorIndex } from '../common/primitives/Types';
import { ITerminalOptions } from '../common/Types';
import { DEFAULT_ATTR_DATA } from '../common/primitives/buffer/BufferLine';
import { IBuffer } from '../common/primitives/buffer/Types';
import { C0, C1ESCAPED } from '../common/primitives/data/EscapeSequences';
import { toRgbString } from '../common/primitives/input/XParseColor';
import { DecorationService } from '../common/services/DecorationService';
import { IDecorationService } from '../common/services/Services';
import { WindowsOptionsReportType } from '../common/InputHandler';
import { AccessibilityManager } from './AccessibilityManager';
import { Linkifier } from './Linkifier';
import { Emitter, EventUtils, type IEvent } from '../common/Event';
import { Emitter, EventUtils, type IEvent } from '../common/primitives/Event';
import { addDisposableListener } from './Dom';
import { MutableDisposable, toDisposable } from '../common/Lifecycle';
import { MutableDisposable, toDisposable } from '../common/primitives/Lifecycle';
export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
public textarea: HTMLTextAreaElement | undefined;
@@ -1072,10 +1073,6 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
* Clear the entire buffer, making the prompt line the new first line.
*/
public clear(): void {
if (this.buffer.ybase === 0 && this.buffer.y === 0) {
// Don't clear if it's already clear
return;
}
this.buffer.clearAllMarkers();
this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)!);
this.buffer.lines.length = 1;
+2 -2
View File
@@ -5,8 +5,8 @@
* Minimal DOM helpers for xterm.js browser code.
*/
import { IntervalTimer } from '../common/Async';
import { IDisposable } from '../common/Lifecycle';
import { IntervalTimer } from '../common/primitives/Async';
import { IDisposable } from '../common/primitives/Lifecycle';
export function getWindow(e: Node | UIEvent | undefined | null): Window {
const candidateNode = e as Node | undefined | null;
+3 -3
View File
@@ -4,11 +4,11 @@
*/
import { IBufferCellPosition, ILink, ILinkDecorations, ILinkWithState, ILinkifier2, ILinkifierEvent } from './Types';
import { Disposable, dispose, toDisposable } from '../common/Lifecycle';
import { IDisposable } from '../common/Types';
import { Disposable, dispose, toDisposable } from '../common/primitives/Lifecycle';
import { IDisposable } from '../common/primitives/Types';
import { IBufferService } from '../common/services/Services';
import { ILinkProviderService, IMouseCoordsService, IRenderService } from './services/Services';
import { Emitter } from '../common/Event';
import { Emitter } from '../common/primitives/Event';
import { addDisposableListener } from './Dom';
export class Linkifier extends Disposable implements ILinkifier2 {
+2 -2
View File
@@ -8,8 +8,8 @@ import { OscLinkProvider } from './OscLinkProvider';
import { ILink } from './Types';
import { createCellData, MockBufferService, MockOptionsService } from '../common/TestUtils.test';
import { IBufferService, IOscLinkService } from '../common/services/Services';
import { IOscLinkData } from '../common/Types';
import { IBufferLine } from '../common/buffer/Types';
import { IOscLinkData } from '../common/primitives/Types';
import { IBufferLine } from '../common/primitives/buffer/Types';
class TestOscLinkService implements IOscLinkService {
public serviceBrand: any;
+2 -2
View File
@@ -5,8 +5,8 @@
import { IBufferRange, ILink } from './Types';
import { ILinkProvider } from './services/Services';
import { CellData } from '../common/buffer/CellData';
import { IBufferLine } from '../common/buffer/Types';
import { CellData } from '../common/primitives/buffer/CellData';
import { IBufferLine } from '../common/primitives/buffer/Types';
import { IBufferService, IOptionsService, IOscLinkService } from '../common/services/Services';
export class OscLinkProvider implements ILinkProvider {
+3 -3
View File
@@ -6,10 +6,10 @@
import { MockCompositionHelper, MockRenderer, MockViewport, TestTerminal } from './TestUtils.test';
import type { IBrowser } from './Types';
import { assert } from 'chai';
import { DEFAULT_ATTR_DATA } from '../common/buffer/BufferLine';
import { CellData } from '../common/buffer/CellData';
import { DEFAULT_ATTR_DATA } from '../common/primitives/buffer/BufferLine';
import { CellData } from '../common/primitives/buffer/CellData';
import { MockUnicodeService, createCellData } from '../common/TestUtils.test';
import { IMarker } from '../common/buffer/Types';
import { IMarker } from '../common/primitives/buffer/Types';
const INIT_COLS = 80;
const INIT_ROWS = 24;
+10 -9
View File
@@ -7,19 +7,20 @@ import { IDisposable, IMarker, ILinkProvider, IDecorationOptions, IDecoration, I
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IMouseService, IRenderService, ISelectionService, IThemeService } from './services/Services';
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from './renderer/shared/Types';
import { IColorSet, ITerminal, ILinkifier2, IBrowser, IViewport, ICompositionHelper, CharacterJoinerHandler, IBufferRange, ReadonlyColorSet, IBufferElementProvider } from './Types';
import { IAttributeData, IBuffer, IBufferLine, IBufferSet, ICellData } from '../common/buffer/Types';
import { ICircularList } from '../common/CircularList';
import { XtermListener, ICharset, ITerminalOptions, ColorIndex } from '../common/Types';
import { Buffer } from '../common/buffer/Buffer';
import * as Browser from '../common/Platform';
import { IAttributeData, IBuffer, IBufferLine, IBufferSet, ICellData } from '../common/primitives/buffer/Types';
import { ICircularList } from '../common/primitives/CircularList';
import { XtermListener, ICharset, ColorIndex } from '../common/primitives/Types';
import { ITerminalOptions } from '../common/Types';
import { Buffer } from '../common/primitives/buffer/Buffer';
import * as Browser from '../common/primitives/Platform';
import { CoreBrowserTerminal } from './CoreBrowserTerminal';
import { IUnicodeService, IOptionsService, ICoreService, IMouseStateService } from '../common/services/Services';
import { IFunctionIdentifier, IParams } from '../common/parser/Types';
import { AttributeData } from '../common/buffer/AttributeData';
import { IFunctionIdentifier, IParams } from '../common/primitives/parser/Types';
import { AttributeData } from '../common/primitives/buffer/AttributeData';
import { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from './selection/Types';
import { css } from '../common/Color';
import { css } from '../common/primitives/Color';
import { createRenderDimensions } from './renderer/shared/RendererUtils';
import { Emitter, type IEvent } from '../common/Event';
import { Emitter, type IEvent } from '../common/primitives/Event';
export class TestTerminal extends CoreBrowserTerminal {
public get curAttrData(): IAttributeData { return (this as any)._inputHandler._curAttrData; }
+5 -4
View File
@@ -3,12 +3,13 @@
* @license MIT
*/
import { IColor, ITerminalOptions } from '../common/Types';
import { CharData, IBuffer } from '../common/buffer/Types';
import { IColor } from '../common/primitives/Types';
import { ITerminalOptions } from '../common/Types';
import { CharData, IBuffer } from '../common/primitives/buffer/Types';
import { ICoreTerminal } from '../common/CoreTerminal';
import { IDisposable, IRenderDimensions as IRenderDimensionsApi, Terminal as ITerminalApi } from '@xterm/xterm';
import { channels, css } from '../common/Color';
import type { IEvent } from '../common/Event';
import { channels, css } from '../common/primitives/Color';
import type { IEvent } from '../common/primitives/Event';
/**
* A portion of the public API that are implemented identially internally and simply passed through.
+3 -3
View File
@@ -5,13 +5,13 @@
import { ICoreBrowserService, IRenderService, IThemeService } from './services/Services';
import { ViewportConstants } from './shared/Constants';
import { Disposable, toDisposable } from '../common/Lifecycle';
import { Disposable, toDisposable } from '../common/primitives/Lifecycle';
import { IBufferService, ICoreService, IMouseStateService, IOptionsService } from '../common/services/Services';
import { CoreMouseEventType } from '../common/Types';
import { CoreMouseEventType } from '../common/primitives/Types';
import { scheduleAtNextAnimationFrame } from './Dom';
import { SmoothScrollableElement } from './scrollable/scrollableElement';
import type { IScrollableElementChangeOptions } from './scrollable/scrollableElementOptions';
import { Emitter, EventUtils } from '../common/Event';
import { Emitter, EventUtils } from '../common/primitives/Event';
import { Scrollable, ScrollbarVisibility, type IScrollEvent } from './scrollable/scrollable';
export class Viewport extends Disposable {
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { ICoreBrowserService, IRenderService } from '../services/Services';
import { Disposable, toDisposable } from '../../common/Lifecycle';
import { Disposable, toDisposable } from '../../common/primitives/Lifecycle';
import { IBufferService, IDecorationService, IInternalDecoration } from '../../common/services/Services';
export class BufferDecorationRenderer extends Disposable {
@@ -5,7 +5,7 @@
import { ColorZoneStore, IColorZone, IColorZoneStore } from './ColorZoneStore';
import { ICoreBrowserService, IRenderService, IThemeService } from '../services/Services';
import { Disposable, toDisposable } from '../../common/Lifecycle';
import { Disposable, toDisposable } from '../../common/primitives/Lifecycle';
import { IBufferService, IDecorationService, IOptionsService } from '../../common/services/Services';
const enum Constants {
+1 -1
View File
@@ -5,7 +5,7 @@
import { IRenderService } from '../services/Services';
import { IBufferService, ICoreService, IOptionsService } from '../../common/services/Services';
import { C0 } from '../../common/data/EscapeSequences';
import { C0 } from '../../common/primitives/data/EscapeSequences';
interface IPosition {
start: number;
+1 -1
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { C0 } from '../../common/data/EscapeSequences';
import { C0 } from '../../common/primitives/data/EscapeSequences';
import { IBufferService } from '../../common/services/Services';
const enum Direction {
+2 -2
View File
@@ -6,14 +6,14 @@
import * as Strings from '../LocalizableStrings';
import { CoreBrowserTerminal as TerminalCore } from '../CoreBrowserTerminal';
import { IBufferRange, ITerminal } from '../Types';
import { Disposable } from '../../common/Lifecycle';
import { Disposable } from '../../common/primitives/Lifecycle';
import { ITerminalOptions } from '../../common/Types';
import { AddonManager } from '../../common/public/AddonManager';
import { BufferNamespaceApi } from '../../common/public/BufferNamespaceApi';
import { ParserApi } from '../../common/public/ParserApi';
import { UnicodeApi } from '../../common/public/UnicodeApi';
import { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, IRenderDimensions, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from '@xterm/xterm';
import type { IEvent } from '../../common/Event';
import type { IEvent } from '../../common/primitives/Event';
/**
* The set of options that only have an effect when set in the Terminal constructor.
+17 -7
View File
@@ -12,10 +12,10 @@ import { TextBlinkStateManager } from '../shared/TextBlinkStateManager';
import { IRenderDimensions, IRenderer, IRequestRedrawEvent, ISelectionRenderModel } from '../shared/Types';
import { ICharSizeService, ICoreBrowserService, IThemeService } from '../../services/Services';
import { ILinkifier2, ILinkifierEvent, ITerminal, ReadonlyColorSet } from '../../Types';
import { color } from '../../../common/Color';
import { Disposable, toDisposable } from '../../../common/Lifecycle';
import { color } from '../../../common/primitives/Color';
import { Disposable, toDisposable } from '../../../common/primitives/Lifecycle';
import { IBufferService, ICoreService, IInstantiationService, IOptionsService } from '../../../common/services/Services';
import { Emitter } from '../../../common/Event';
import { Emitter } from '../../../common/primitives/Event';
import { addDisposableListener } from '../../Dom';
@@ -536,9 +536,14 @@ export class DomRenderer extends Disposable implements IRenderer {
for (let y = start; y <= end; y++) {
const row = y + buffer.ydisp;
const rowElement = this._rowElements[y];
if (!rowElement) {
continue;
}
const lineData = buffer.lines.get(row);
if (!rowElement || !lineData) {
break;
if (!lineData) {
rowElement.replaceChildren();
this._setRowBlinkState(y, false);
continue;
}
rowElement.replaceChildren(
...this._rowFactory.createRow(
@@ -610,9 +615,14 @@ export class DomRenderer extends Disposable implements IRenderer {
for (let i = y; i <= y2; ++i) {
const row = i + buffer.ydisp;
const rowElement = this._rowElements[i];
if (!rowElement) {
continue;
}
const bufferline = buffer.lines.get(row);
if (!rowElement || !bufferline) {
break;
if (!bufferline) {
rowElement.replaceChildren();
this._setRowBlinkState(i, false);
continue;
}
rowElement.replaceChildren(
...this._rowFactory.createRow(
@@ -6,11 +6,11 @@
import jsdom = require('jsdom');
import { assert } from 'chai';
import { DomRendererRowFactory } from './DomRendererRowFactory';
import { NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR, DEFAULT_ATTR, FgFlags, BgFlags, Attributes, UnderlineStyle } from '../../../common/buffer/Constants';
import { BufferLine, DEFAULT_ATTR_DATA } from '../../../common/buffer/BufferLine';
import { BufferLineStringCache } from '../../../common/buffer/BufferLineStringCache';
import { IBufferLine } from '../../../common/buffer/Types';
import { CellData } from '../../../common/buffer/CellData';
import { NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR, DEFAULT_ATTR, FgFlags, BgFlags, Attributes, UnderlineStyle } from '../../../common/primitives/buffer/Constants';
import { BufferLine, DEFAULT_ATTR_DATA } from '../../../common/primitives/buffer/BufferLine';
import { BufferLineStringCache } from '../../../common/primitives/buffer/BufferLineStringCache';
import { IBufferLine } from '../../../common/primitives/buffer/Types';
import { CellData } from '../../../common/primitives/buffer/CellData';
import { MockCoreService, MockDecorationService, MockOptionsService, createCellData, NULL_CELL_DATA } from '../../../common/TestUtils.test';
import { MockCharacterJoinerService, MockCoreBrowserService, MockThemeService } from '../../TestUtils.test';
import { TestWidthCache } from './WidthCache.test';
@@ -3,17 +3,17 @@
* @license MIT
*/
import { IColor } from '../../../common/Types';
import { IBufferLine, ICellData } from '../../../common/buffer/Types';
import { IColor } from '../../../common/primitives/Types';
import { IBufferLine, ICellData } from '../../../common/primitives/buffer/Types';
import { INVERTED_DEFAULT_COLOR } from '../shared/Constants';
import { WHITESPACE_CELL_CHAR, Attributes } from '../../../common/buffer/Constants';
import { CellData } from '../../../common/buffer/CellData';
import { WHITESPACE_CELL_CHAR, Attributes } from '../../../common/primitives/buffer/Constants';
import { CellData } from '../../../common/primitives/buffer/CellData';
import { ICoreService, IDecorationService, IOptionsService } from '../../../common/services/Services';
import { channels, color } from '../../../common/Color';
import { channels, color } from '../../../common/primitives/Color';
import { ICharacterJoinerService, ICoreBrowserService, IThemeService } from '../../services/Services';
import { JoinedCellData } from '../../services/CharacterJoinerService';
import { treatGlyphAsBackgroundColor } from '../shared/RendererUtils';
import { AttributeData } from '../../../common/buffer/AttributeData';
import { AttributeData } from '../../../common/primitives/buffer/AttributeData';
import { WidthCache } from './WidthCache';
import { IColorContrastCache } from '../../Types';
+1 -1
View File
@@ -4,7 +4,7 @@
*/
import { throwIfFalsy } from '../shared/RendererUtils';
import { IDisposable } from '../../../common/Types';
import { IDisposable } from '../../../common/primitives/Types';
import { FontWeight } from '../../../common/services/Services';
@@ -7,7 +7,7 @@ import { assert } from 'chai';
import { TextBlinkStateManager } from './TextBlinkStateManager';
import { MockOptionsService } from '../../../common/TestUtils.test';
import type { ICoreBrowserService } from '../../services/Services';
import { Emitter } from '../../../common/Event';
import { Emitter } from '../../../common/primitives/Event';
class FakeWindow {
public nextId = 1;
@@ -4,7 +4,7 @@
*/
import { ICoreBrowserService } from '../../services/Services';
import { Disposable, toDisposable } from '../../../common/Lifecycle';
import { Disposable, toDisposable } from '../../../common/primitives/Lifecycle';
import { IOptionsService } from '../../../common/services/Services';
export class TextBlinkStateManager extends Disposable {
+2 -2
View File
@@ -5,8 +5,8 @@
import { Terminal } from '@xterm/xterm';
import { ITerminal } from '../../Types';
import { IDisposable } from '../../../common/Types';
import type { IEvent } from '../../../common/Event';
import { IDisposable } from '../../../common/primitives/Types';
import type { IEvent } from '../../../common/primitives/Event';
export interface IDimensions {
width: number;
+1 -1
View File
@@ -11,7 +11,7 @@ import { ScrollbarArrow, IScrollbarArrowOptions } from './scrollbarArrow';
import { ScrollbarState } from './scrollbarState';
import { ScrollbarVisibilityController } from './scrollbarVisibilityController';
import { Widget } from './widget';
import * as platform from '../../common/Platform';
import * as platform from '../../common/primitives/Platform';
import { INewScrollPosition, Scrollable, ScrollbarVisibility } from './scrollable';
/**
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as dom from '../Dom';
import { DisposableStore, IDisposable, toDisposable } from '../../common/Lifecycle';
import { DisposableStore, IDisposable, toDisposable } from '../../common/primitives/Lifecycle';
type PointerMoveCallback = (event: PointerEvent) => void;
type OnStopCallback = () => void;
+1 -1
View File
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as platform from '../../common/Platform';
import * as platform from '../../common/primitives/Platform';
interface IWindowChainElement {
readonly window: WeakRef<Window>;
+2 -2
View File
@@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Emitter, IEvent } from '../../common/Event';
import { Disposable, IDisposable } from '../../common/Lifecycle';
import { Emitter, IEvent } from '../../common/primitives/Event';
import { Disposable, IDisposable } from '../../common/primitives/Lifecycle';
export const enum ScrollbarVisibility {
AUTO = 1,
+4 -4
View File
@@ -11,10 +11,10 @@ import { HorizontalScrollbar } from './horizontalScrollbar';
import { IScrollableElementChangeOptions, IScrollableElementCreationOptions, IScrollableElementResolvedOptions } from './scrollableElementOptions';
import { VerticalScrollbar } from './verticalScrollbar';
import { Widget } from './widget';
import { TimeoutTimer } from '../../common/Async';
import { Emitter, IEvent } from '../../common/Event';
import { IDisposable, dispose } from '../../common/Lifecycle';
import * as platform from '../../common/Platform';
import { TimeoutTimer } from '../../common/primitives/Async';
import { Emitter, IEvent } from '../../common/primitives/Event';
import { IDisposable, dispose } from '../../common/primitives/Lifecycle';
import * as platform from '../../common/primitives/Platform';
import { INewScrollDimensions, INewScrollPosition, IScrollDimensions, IScrollPosition, IScrollEvent, Scrollable, ScrollbarVisibility } from './scrollable';
// import 'vs/css!./media/scrollbars';
+1 -1
View File
@@ -5,7 +5,7 @@
import { GlobalPointerMoveMonitor } from './globalPointerMoveMonitor';
import { Widget } from './widget';
import { TimeoutTimer } from '../../common/Async';
import { TimeoutTimer } from '../../common/primitives/Async';
import * as dom from '../Dom';
export interface IScrollbarArrowOptions {
@@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import { FastDomNode } from './fastDomNode';
import { TimeoutTimer } from '../../common/Async';
import { Disposable } from '../../common/Lifecycle';
import { TimeoutTimer } from '../../common/primitives/Async';
import { Disposable } from '../../common/primitives/Lifecycle';
import { ScrollbarVisibility } from './scrollable';
export class ScrollbarVisibilityController extends Disposable {
+1 -1
View File
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as DomUtils from '../Dom';
import { Disposable, IDisposable, toDisposable } from '../../common/Lifecycle';
import { Disposable, IDisposable, toDisposable } from '../../common/primitives/Lifecycle';
const mainWindow = (typeof window === 'object' ? window : globalThis) as Window & typeof globalThis;
+1 -1
View File
@@ -5,7 +5,7 @@
import * as dom from '../Dom';
import { IMouseEvent, StandardMouseEvent } from './mouseEvent';
import { Disposable } from '../../common/Lifecycle';
import { Disposable } from '../../common/primitives/Lifecycle';
export abstract class Widget extends Disposable {
@@ -64,6 +64,13 @@ describe('SelectionModel', () => {
assert.deepEqual(model.finalSelectionStart, undefined);
assert.deepEqual(model.finalSelectionEnd, undefined);
});
it('should reset selection start to origin when start row is trimmed', () => {
model.selectionStart = [50, 0];
model.selectionEnd = [10, 2];
assert.equal(model.handleTrim(1), true);
assert.deepEqual(model.finalSelectionStart, [0, 0]);
assert.deepEqual(model.finalSelectionEnd, [10, 1]);
});
});
describe('finalSelectionStart', () => {
+3 -2
View File
@@ -135,9 +135,10 @@ export class SelectionModel {
return true;
}
// If the selection start is trimmed, ensure the start column is 0.
// If the selection start row is trimmed away, reset to the buffer origin.
if (this.selectionStart && this.selectionStart[1] < 0) {
this.selectionStart[1] = 0;
this.selectionStart = [0, 0];
return true;
}
return false;
}
+2 -2
View File
@@ -5,8 +5,8 @@
import { IOptionsService } from '../../common/services/Services';
import { ICharSizeService } from './Services';
import { Disposable } from '../../common/Lifecycle';
import { Emitter } from '../../common/Event';
import { Disposable } from '../../common/primitives/Lifecycle';
import { Emitter } from '../../common/primitives/Event';
export class CharSizeService extends Disposable implements ICharSizeService {
public serviceBrand: undefined;
@@ -6,10 +6,10 @@
import { assert } from 'chai';
import { ICharacterJoinerService } from './Services';
import { CharacterJoinerService } from './CharacterJoinerService';
import { BufferLine } from '../../common/buffer/BufferLine';
import { BufferLineStringCache } from '../../common/buffer/BufferLineStringCache';
import { IBufferLine } from '../../common/buffer/Types';
import { CellData } from '../../common/buffer/CellData';
import { BufferLine } from '../../common/primitives/buffer/BufferLine';
import { BufferLineStringCache } from '../../common/primitives/buffer/BufferLineStringCache';
import { IBufferLine } from '../../common/primitives/buffer/Types';
import { CellData } from '../../common/primitives/buffer/CellData';
import { MockBufferService, createCellData } from '../../common/TestUtils.test';
const TEST_STRING_CACHE = new BufferLineStringCache();
+10 -8
View File
@@ -3,11 +3,11 @@
* @license MIT
*/
import { CharData, IBufferLine, ICellData } from '../../common/buffer/Types';
import { CharData, IBufferLine, ICellData } from '../../common/primitives/buffer/Types';
import { ICharacterJoiner } from '../Types';
import { AttributeData } from '../../common/buffer/AttributeData';
import { WHITESPACE_CELL_CHAR, Content } from '../../common/buffer/Constants';
import { CellData } from '../../common/buffer/CellData';
import { AttributeData } from '../../common/primitives/buffer/AttributeData';
import { WHITESPACE_CELL_CHAR, Content } from '../../common/primitives/buffer/Constants';
import { CellData } from '../../common/primitives/buffer/CellData';
import { IBufferService } from '../../common/services/Services';
import { ICharacterJoinerService } from './Services';
@@ -100,6 +100,7 @@ export class CharacterJoinerService implements ICharacterJoinerService {
const ranges: [number, number][] = [];
const lineStr = line.translateToString(true);
const trimmedLength = line.getTrimmedLength();
// Because some cells can be represented by multiple javascript characters,
// we track the cell and the string indexes separately. This allows us to
@@ -111,7 +112,7 @@ export class CharacterJoinerService implements ICharacterJoinerService {
let rangeAttrFG = line.getFg(0);
let rangeAttrBG = line.getBg(0);
for (let x = 0; x < line.getTrimmedLength(); x++) {
for (let x = 0; x < trimmedLength; x++) {
line.loadCell(x, this._workCell);
if (this._workCell.getWidth() === 0) {
@@ -147,7 +148,7 @@ export class CharacterJoinerService implements ICharacterJoinerService {
}
// Process any trailing ranges.
if (this._bufferService.cols - rangeStartColumn > 1) {
if (trimmedLength - rangeStartColumn > 1) {
const joinedRanges = this._getJoinedRanges(
lineStr,
rangeStartStringIndex,
@@ -216,7 +217,8 @@ export class CharacterJoinerService implements ICharacterJoinerService {
return;
}
for (let x = startCol; x < this._bufferService.cols; x++) {
const trimmedLength = line.getTrimmedLength();
for (let x = startCol; x < trimmedLength; x++) {
const width = line.getWidth(x);
const length = line.getString(x).length || WHITESPACE_CELL_CHAR.length;
@@ -264,7 +266,7 @@ export class CharacterJoinerService implements ICharacterJoinerService {
// If there is still a range left at the end, it must extend all the way to
// the end of the line.
if (currentRange) {
currentRange[1] = this._bufferService.cols;
currentRange[1] = trimmedLength;
}
}
+2 -2
View File
@@ -4,9 +4,9 @@
*/
import { ICoreBrowserService } from './Services';
import { Emitter, EventUtils } from '../../common/Event';
import { Emitter, EventUtils } from '../../common/primitives/Event';
import { addDisposableListener } from '../Dom';
import { Disposable, MutableDisposable, toDisposable } from '../../common/Lifecycle';
import { Disposable, MutableDisposable, toDisposable } from '../../common/primitives/Lifecycle';
export class CoreBrowserService extends Disposable implements ICoreBrowserService {
public serviceBrand: undefined;
+5 -5
View File
@@ -4,12 +4,12 @@
*/
import { IKeyboardService } from './Services';
import { evaluateKeyboardEvent } from '../../common/input/Keyboard';
import { KittyKeyboard, KittyKeyboardEventType, KittyKeyboardFlags } from '../../common/input/KittyKeyboard';
import { Win32InputMode } from '../../common/input/Win32InputMode';
import { isMac } from '../../common/Platform';
import { evaluateKeyboardEvent } from '../../common/primitives/input/Keyboard';
import { KittyKeyboard, KittyKeyboardEventType, KittyKeyboardFlags } from '../../common/primitives/input/KittyKeyboard';
import { Win32InputMode } from '../../common/primitives/input/Win32InputMode';
import { isMac } from '../../common/primitives/Platform';
import { ICoreService, IOptionsService } from '../../common/services/Services';
import { IKeyboardResult } from '../../common/Types';
import { IKeyboardResult } from '../../common/primitives/Types';
export class KeyboardService implements IKeyboardService {
public serviceBrand: undefined;
+2 -2
View File
@@ -1,6 +1,6 @@
import { ILinkProvider, ILinkProviderService } from './Services';
import { Disposable, toDisposable } from '../../common/Lifecycle';
import { IDisposable } from '../../common/Types';
import { Disposable, toDisposable } from '../../common/primitives/Lifecycle';
import { IDisposable } from '../../common/primitives/Types';
export class LinkProviderService extends Disposable implements ILinkProviderService {
declare public serviceBrand: undefined;
+1 -1
View File
@@ -5,7 +5,7 @@
import { assert } from 'chai';
import { AltMouseCursorController, MouseEventCssClasses, MouseService } from './MouseService';
import { MouseStateService } from '../../common/services/MouseStateService';
import { CoreMouseAction, CoreMouseButton } from '../../common/Types';
import { CoreMouseAction, CoreMouseButton } from '../../common/primitives/Types';
import { IBufferService, ICoreService, ILogService, IOptionsService } from '../../common/services/Services';
import { OptionsService } from '../../common/services/OptionsService';
import { MockCoreBrowserService, MockRenderService, MockSelectionService } from '../TestUtils.test';
+3 -3
View File
@@ -5,9 +5,9 @@
import { addDisposableListener } from '../Dom';
import { IBufferService, IMouseStateService, ICoreService, ILogService, IOptionsService } from '../../common/services/Services';
import { CoreMouseAction, CoreMouseButton, CoreMouseEventType, ICoreMouseEvent, IDisposable } from '../../common/Types';
import { C0 } from '../../common/data/EscapeSequences';
import { DisposableStore, MutableDisposable, toDisposable } from '../../common/Lifecycle';
import { CoreMouseAction, CoreMouseButton, CoreMouseEventType, ICoreMouseEvent, IDisposable } from '../../common/primitives/Types';
import { C0 } from '../../common/primitives/data/EscapeSequences';
import { DisposableStore, MutableDisposable, toDisposable } from '../../common/primitives/Lifecycle';
import { ICoreBrowserService, IMouseCoordsService, IMouseService, IMouseServiceTarget, IRenderService, ISelectionService } from './Services';
import { Gesture, EventType as GestureEventType, IGestureEvent } from '../scrollable/touch';
+3 -3
View File
@@ -7,10 +7,10 @@ import { RenderDebouncer } from '../RenderDebouncer';
import { IRenderDebouncerWithCallback } from '../Types';
import { IRenderDimensions, IRenderer } from '../renderer/shared/Types';
import { ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from './Services';
import { Disposable, MutableDisposable, toDisposable } from '../../common/Lifecycle';
import { DebouncedIdleTask } from '../../common/TaskQueue';
import { Disposable, MutableDisposable, toDisposable } from '../../common/primitives/Lifecycle';
import { DebouncedIdleTask } from '../../common/primitives/TaskQueue';
import { IBufferService, ICoreService, IDecorationService, ILogService, IOptionsService } from '../../common/services/Services';
import { Emitter } from '../../common/Event';
import { Emitter } from '../../common/primitives/Event';
interface ISelectionState {
start: [number, number] | undefined;
@@ -6,13 +6,13 @@
import { assert } from 'chai';
import { SelectionService, SelectionMode } from './SelectionService';
import { SelectionModel } from '../selection/SelectionModel';
import { IBuffer, IBufferLine } from '../../common/buffer/Types';
import { IBuffer, IBufferLine } from '../../common/primitives/buffer/Types';
import { MockBufferService, MockOptionsService, MockCoreService, MockMouseStateService, createCellData } from '../../common/TestUtils.test';
import { BufferLine } from '../../common/buffer/BufferLine';
import { BufferLineStringCache } from '../../common/buffer/BufferLineStringCache';
import { BufferLine } from '../../common/primitives/buffer/BufferLine';
import { BufferLineStringCache } from '../../common/primitives/buffer/BufferLineStringCache';
import { IBufferService, IOptionsService } from '../../common/services/Services';
import { MockCoreBrowserService, MockMouseService, MockRenderService } from '../TestUtils.test';
import { CellData } from '../../common/buffer/CellData';
import { CellData } from '../../common/primitives/buffer/CellData';
import { IRenderService } from './Services';
const TEST_STRING_CACHE = new BufferLineStringCache();
+8 -8
View File
@@ -9,14 +9,14 @@ import { moveToCellSequence } from '../input/MoveToCell';
import { SelectionModel } from '../selection/SelectionModel';
import { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from '../selection/Types';
import { ICoreBrowserService, IMouseCoordsService, IRenderService, ISelectionService } from './Services';
import { Disposable, MutableDisposable, toDisposable } from '../../common/Lifecycle';
import * as Browser from '../../common/Platform';
import { IDisposable } from '../../common/Types';
import { IBuffer, IBufferLine, ICellData } from '../../common/buffer/Types';
import { getRangeLength } from '../../common/buffer/BufferRange';
import { CellData } from '../../common/buffer/CellData';
import { Disposable, MutableDisposable, toDisposable } from '../../common/primitives/Lifecycle';
import * as Browser from '../../common/primitives/Platform';
import { IDisposable } from '../../common/primitives/Types';
import { IBuffer, IBufferLine, ICellData } from '../../common/primitives/buffer/Types';
import { getRangeLength } from '../../common/primitives/buffer/BufferRange';
import { CellData } from '../../common/primitives/buffer/CellData';
import { IBufferService, ICoreService, IMouseStateService, IOptionsService } from '../../common/services/Services';
import { Emitter } from '../../common/Event';
import { Emitter } from '../../common/primitives/Event';
const enum Constants {
/**
@@ -704,7 +704,7 @@ export class SelectionService extends Disposable implements ISelectionService {
if (this._activeSelectionMode !== SelectionMode.COLUMN) {
this._model.selectionEnd[0] = this._bufferService.cols;
}
this._model.selectionEnd[1] = Math.min(buffer.ydisp + this._bufferService.rows, buffer.lines.length - 1);
this._model.selectionEnd[1] = Math.min(buffer.ydisp + this._bufferService.rows - 1, buffer.lines.length - 1);
} else {
if (this._activeSelectionMode !== SelectionMode.COLUMN) {
this._model.selectionEnd[0] = 0;
+2 -2
View File
@@ -7,8 +7,8 @@ import { IRenderDimensions, IRenderer } from '../renderer/shared/Types';
import { IColorSet, ILink, ReadonlyColorSet } from '../Types';
import { ISelectionRedrawRequestEvent as ISelectionRequestRedrawEvent, ISelectionRequestScrollLinesEvent } from '../selection/Types';
import { createDecorator } from '../../common/services/ServiceRegistry';
import { AllColorIndex, IDisposable, IKeyboardResult } from '../../common/Types';
import type { IEvent } from '../../common/Event';
import { AllColorIndex, IDisposable, IKeyboardResult } from '../../common/primitives/Types';
import type { IEvent } from '../../common/primitives/Event';
export const ICharSizeService = createDecorator<ICharSizeService>('CharSizeService');
export interface ICharSizeService {
+4 -4
View File
@@ -6,11 +6,11 @@
import { ColorContrastCache } from '../ColorContrastCache';
import { IThemeService } from './Services';
import { DEFAULT_ANSI_COLORS, IColorContrastCache, IColorSet, ReadonlyColorSet } from '../Types';
import { color, css, NULL_COLOR } from '../../common/Color';
import { Disposable } from '../../common/Lifecycle';
import { color, css, NULL_COLOR } from '../../common/primitives/Color';
import { Disposable } from '../../common/primitives/Lifecycle';
import { IOptionsService, ITheme } from '../../common/services/Services';
import { AllColorIndex, IColor, SpecialColorIndex } from '../../common/Types';
import { Emitter } from '../../common/Event';
import { AllColorIndex, IColor, SpecialColorIndex } from '../../common/primitives/Types';
import { Emitter } from '../../common/primitives/Event';
interface IRestoreColorSet {
foreground: IColor;
+8 -7
View File
@@ -26,20 +26,21 @@ import { InstantiationService } from './services/InstantiationService';
import { LogService } from './services/LogService';
import { BufferService, BufferServiceConstants } from './services/BufferService';
import { OptionsService } from './services/OptionsService';
import { IDisposable, IScrollEvent, ITerminalOptions, IParams } from './Types';
import { IAttributeData, IBufferSet } from './buffer/Types';
import { IDisposable, IParams } from './primitives/Types';
import { IScrollEvent, ITerminalOptions } from './Types';
import { IAttributeData, IBufferSet } from './primitives/buffer/Types';
import { CoreService } from './services/CoreService';
import { MouseStateService } from './services/MouseStateService';
import { UnicodeV6 } from './input/UnicodeV6';
import { UnicodeV6 } from './primitives/input/UnicodeV6';
import { UnicodeService } from './services/UnicodeService';
import { CharsetService } from './services/CharsetService';
import { updateWindowsModeWrappedState } from './WindowsMode';
import { IFunctionIdentifier } from './parser/Types';
import { IFunctionIdentifier } from './primitives/parser/Types';
import { InputHandler } from './InputHandler';
import { WriteBuffer } from './input/WriteBuffer';
import { WriteBuffer } from './primitives/input/WriteBuffer';
import { OscLinkService } from './services/OscLinkService';
import { Emitter, EventUtils, type IEvent } from './Event';
import { Disposable, MutableDisposable, toDisposable } from './Lifecycle';
import { Emitter, EventUtils, type IEvent } from './primitives/Event';
import { Disposable, MutableDisposable, toDisposable } from './primitives/Lifecycle';
// Only trigger this warning a single time per session
let hasWriteSyncWarnHappened = false;
+8 -8
View File
@@ -5,13 +5,13 @@
import { assert } from 'chai';
import { InputHandler } from './InputHandler';
import { IColorEvent, ColorRequestType, SpecialColorIndex } from './Types';
import { IAttributeData, IBufferLine } from './buffer/Types';
import { DEFAULT_ATTR_DATA } from './buffer/BufferLine';
import { CellData } from './buffer/CellData';
import { Attributes, BgFlags, UnderlineStyle } from './buffer/Constants';
import { AttributeData, ExtendedAttrs } from './buffer/AttributeData';
import { Params } from './parser/Params';
import { IColorEvent, ColorRequestType, SpecialColorIndex } from './primitives/Types';
import { IAttributeData, IBufferLine } from './primitives/buffer/Types';
import { DEFAULT_ATTR_DATA } from './primitives/buffer/BufferLine';
import { CellData } from './primitives/buffer/CellData';
import { Attributes, BgFlags, UnderlineStyle } from './primitives/buffer/Constants';
import { AttributeData, ExtendedAttrs } from './primitives/buffer/AttributeData';
import { Params } from './primitives/parser/Params';
import { MockCoreService, MockBufferService, MockOptionsService, MockLogService, MockMouseStateService, MockCharsetService, MockUnicodeService, MockOscLinkService, extendedAttributes } from './TestUtils.test';
import { IBufferService, ICoreService, type IOscLinkService } from './services/Services';
import { DEFAULT_OPTIONS } from './services/OptionsService';
@@ -19,7 +19,7 @@ import { BufferService } from './services/BufferService';
import { CharsetService } from './services/CharsetService';
import { CoreService } from './services/CoreService';
import { OscLinkService } from './services/OscLinkService';
import { CHARSETS } from './data/Charsets';
import { CHARSETS } from './primitives/data/Charsets';
function getCursor(bufferService: IBufferService): number[] {
+19 -18
View File
@@ -4,26 +4,27 @@
* @license MIT
*/
import { IInputHandler, IDisposable, IWindowOptions, IColorEvent, IParseStack, ColorIndex, ColorRequestType, SpecialColorIndex } from './Types';
import { IAttributeData, IBuffer } from './buffer/Types';
import { C0, C1 } from './data/EscapeSequences';
import { CHARSETS, DEFAULT_CHARSET } from './data/Charsets';
import { EscapeSequenceParser } from './parser/EscapeSequenceParser';
import { Disposable } from './Lifecycle';
import { StringToUtf32, stringFromCodePoint, Utf8ToUtf32 } from './input/TextDecoder';
import { BufferLine, DEFAULT_ATTR_DATA } from './buffer/BufferLine';
import { IParsingState, IEscapeSequenceParser, IParams, IFunctionIdentifier } from './parser/Types';
import { NULL_CELL_CODE, NULL_CELL_WIDTH, Attributes, FgFlags, BgFlags, Content, UnderlineStyle } from './buffer/Constants';
import { CellData } from './buffer/CellData';
import { AttributeData } from './buffer/AttributeData';
import { IDisposable, IColorEvent, ColorIndex, ColorRequestType, SpecialColorIndex } from './primitives/Types';
import { IInputHandler, IWindowOptions, IParseStack } from './Types';
import { IAttributeData, IBuffer } from './primitives/buffer/Types';
import { C0, C1 } from './primitives/data/EscapeSequences';
import { CHARSETS, DEFAULT_CHARSET } from './primitives/data/Charsets';
import { EscapeSequenceParser } from './primitives/parser/EscapeSequenceParser';
import { Disposable } from './primitives/Lifecycle';
import { StringToUtf32, stringFromCodePoint, Utf8ToUtf32 } from './primitives/input/TextDecoder';
import { BufferLine, DEFAULT_ATTR_DATA } from './primitives/buffer/BufferLine';
import { IParsingState, IEscapeSequenceParser, IParams, IFunctionIdentifier } from './primitives/parser/Types';
import { NULL_CELL_CODE, NULL_CELL_WIDTH, Attributes, FgFlags, BgFlags, Content, UnderlineStyle } from './primitives/buffer/Constants';
import { CellData } from './primitives/buffer/CellData';
import { AttributeData } from './primitives/buffer/AttributeData';
import { ICoreService, IBufferService, IOptionsService, ILogService, IMouseStateService, ICharsetService, IUnicodeService, LogLevelEnum, IOscLinkService } from './services/Services';
import { UnicodeService } from './services/UnicodeService';
import { OscHandler } from './parser/OscParser';
import { DcsHandler } from './parser/DcsParser';
import { ApcHandler } from './parser/ApcParser';
import { parseColor } from './input/XParseColor';
import { Emitter } from './Event';
import { XTERM_VERSION } from './Version';
import { OscHandler } from './primitives/parser/OscParser';
import { DcsHandler } from './primitives/parser/DcsParser';
import { ApcHandler } from './primitives/parser/ApcParser';
import { parseColor } from './primitives/input/XParseColor';
import { Emitter } from './primitives/Event';
import { XTERM_VERSION } from './primitives/Version';
/**
* Map collect to glevel. Used in `selectCharset`.
+8 -7
View File
@@ -6,14 +6,15 @@
import { IBufferService, ICoreService, ILogService, IOptionsService, ITerminalOptions, IMouseStateService, ICharsetService, UnicodeCharProperties, UnicodeCharWidth, IUnicodeService, IUnicodeVersionProvider, LogLevelEnum, IDecorationService, IInternalDecoration, IOscLinkService, type IBufferResizeEvent } from './services/Services';
import { UnicodeService } from './services/UnicodeService';
import { DEFAULT_OPTIONS } from './services/OptionsService';
import { IAttributeData, IBuffer, IBufferLine, IBufferSet, IExtendedAttrs } from './buffer/Types';
import { BufferSet } from './buffer/BufferSet';
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEventType, ICharset, IModes, IOscLinkData, IDisposable } from './Types';
import { UnicodeV6 } from './input/UnicodeV6';
import { IAttributeData, IBuffer, IBufferLine, IBufferSet, IExtendedAttrs } from './primitives/buffer/Types';
import { BufferSet } from './primitives/buffer/BufferSet';
import { ICoreMouseEvent, CoreMouseEventType, ICharset, IOscLinkData, IDisposable } from './primitives/Types';
import { IDecPrivateModes, IModes } from './Types';
import { UnicodeV6 } from './primitives/input/UnicodeV6';
import { IDecorationOptions, IDecoration } from '@xterm/xterm';
import { Emitter, type IEvent } from './Event';
import { CellData } from './buffer/CellData';
import { DEFAULT_ATTR, NULL_CELL_CHAR, NULL_CELL_WIDTH } from './buffer/Constants';
import { Emitter, type IEvent } from './primitives/Event';
import { CellData } from './primitives/buffer/CellData';
import { DEFAULT_ATTR, NULL_CELL_CHAR, NULL_CELL_WIDTH } from './primitives/buffer/Constants';
export function createCellData(attr: number, char: string, width: number): CellData {
return CellData.fromCharData([attr, char, width, char.length === 0 ? 0 : char.charCodeAt(0)]);
+2 -226
View File
@@ -4,36 +4,8 @@
*/
import { IFunctionIdentifier, ITerminalOptions as IPublicTerminalOptions } from '@xterm/xterm';
import type { IEvent } from './Event';
/** sequence params serialized to js arrays */
export type ParamsArray = (number | number[])[];
/** Interface of Params storage class. */
export interface IParams {
/** from ctor */
maxLength: number;
maxSubParamsLength: number;
/** param values and its length */
params: Int32Array;
length: number;
/** methods */
clone(): IParams;
toArray(): ParamsArray;
reset(): void;
resetZdm(): void;
addParam(value: number): void;
addSubParam(value: number): void;
hasSubParams(idx: number): boolean;
getSubParams(idx: number): Int32Array | null;
getSubParamsAll(): {[idx: number]: Int32Array};
}
export interface IDisposable {
dispose(): void;
}
import type { IEvent } from './primitives/Event';
import type { CursorStyle, IDisposable, IParams } from './primitives/Types';
// TODO: The options that are not in the public API should be reviewed
export interface ITerminalOptions extends IPublicTerminalOptions {
@@ -42,66 +14,10 @@ export interface ITerminalOptions extends IPublicTerminalOptions {
termName?: string;
}
export type CursorStyle = 'block' | 'underline' | 'bar';
export type CursorInactiveStyle = 'outline' | 'block' | 'bar' | 'underline' | 'none';
export type XtermListener = (...args: any[]) => void;
/**
* A keyboard event interface which does not depend on the DOM, KeyboardEvent implicitly extends
* this event.
*/
export interface IKeyboardEvent {
altKey: boolean;
ctrlKey: boolean;
shiftKey: boolean;
metaKey: boolean;
/** @deprecated See KeyboardEvent.keyCode */
keyCode: number;
key: string;
type: string;
code: string;
}
export interface IScrollEvent {
position: number;
}
export const enum KeyboardResultType {
SEND_KEY,
SELECT_ALL,
PAGE_UP,
PAGE_DOWN
}
export interface IKeyboardResult {
type: KeyboardResultType;
cancel: boolean;
key: string | undefined;
}
export interface ICharset {
[key: string]: string | undefined;
}
export interface IColor {
readonly css: string;
readonly rgba: number; // 32-bit int with rgba in each byte
}
export type IColorRGB = [red: number, green: number, blue: number];
/**
* Tracks the current hyperlink. Since these are treated as extended attirbutes, these get passed on
* to the linkifier when anything is printed. Doing it this way ensures that even when the cursor
* moves around unexpectedly the link is tracked, as opposed to using a start position and
* finalizing it at the end.
*/
export interface IOscLinkData {
id?: string;
uri: string;
}
export interface IModes {
insertMode: boolean;
}
@@ -138,110 +54,6 @@ export interface IKittyKeyboardState {
altStack: number[];
}
export interface IRowRange {
start: number;
end: number;
}
/**
* Interface for mouse events in the core.
*/
export const enum CoreMouseButton {
LEFT = 0,
MIDDLE = 1,
RIGHT = 2,
NONE = 3,
WHEEL = 4,
// additional buttons 1..8
// untested!
AUX1 = 8,
AUX2 = 9,
AUX3 = 10,
AUX4 = 11,
AUX5 = 12,
AUX6 = 13,
AUX7 = 14,
AUX8 = 15
}
export const enum CoreMouseAction {
UP = 0, // buttons, wheel
DOWN = 1, // buttons, wheel
LEFT = 2, // wheel only
RIGHT = 3, // wheel only
MOVE = 32 // buttons only
}
export interface ICoreMouseEvent {
/** column (zero based). */
col: number;
/** row (zero based). */
row: number;
/** xy pixel positions. */
x: number;
y: number;
/**
* Button the action occurred. Due to restrictions of the tracking protocols
* it is not possible to report multiple buttons at once.
* Wheel is treated as a button.
* There are invalid combinations of buttons and actions possible
* (like move + wheel), those are silently ignored by the MouseStateService.
*/
button: CoreMouseButton;
action: CoreMouseAction;
/**
* Modifier states.
* Protocols will add/ignore those based on specific restrictions.
*/
ctrl?: boolean;
alt?: boolean;
shift?: boolean;
}
/**
* CoreMouseEventType
* To be reported to the browser component which events a mouse
* protocol wants to be catched and forwarded as an ICoreMouseEvent
* to MouseStateService.
*/
export const enum CoreMouseEventType {
NONE = 0,
/** any mousedown event */
DOWN = 1,
/** any mouseup event */
UP = 2,
/** any mousemove event while a button is held */
DRAG = 4,
/** any mousemove event without a button */
MOVE = 8,
/** any wheel event */
WHEEL = 16
}
/**
* Mouse protocol interface.
* A mouse protocol can be registered and activated at the MouseStateService.
* `events` should contain a list of needed events as a hint for the browser component
* to install/remove the appropriate event handlers.
* `restrict` applies further protocol specific restrictions like not allowed
* modifiers or filtering invalid event types.
*/
export interface ICoreMouseProtocol {
events: CoreMouseEventType;
restrict: (e: ICoreMouseEvent) => boolean;
}
/**
* CoreMouseEncoding
* The tracking encoding can be registered and activated at the MouseStateService.
* If a ICoreMouseEvent passes all procotol restrictions it will be encoded
* with the active encoding and sent out.
* Note: Returning an empty string will supress sending a mouse report,
* which can be used to skip creating falsey reports in limited encodings
* (DEFAULT only supports up to 223 1-based as coord value).
*/
export type CoreMouseEncoding = (event: ICoreMouseEvent) => string;
/**
* windowOptions
*/
@@ -270,42 +82,6 @@ export interface IWindowOptions {
setWinLines?: boolean;
}
// color events from common, used for OSC 4/10/11/12 and 104/110/111/112
export const enum ColorRequestType {
REPORT = 0,
SET = 1,
RESTORE = 2
}
// IntRange from https://stackoverflow.com/a/39495173
type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N
? Acc[number]
: Enumerate<N, [...Acc, Acc['length']]>;
type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
export type ColorIndex = IntRange<0, 256>; // number from 0 to 255
export type AllColorIndex = ColorIndex | SpecialColorIndex;
export const enum SpecialColorIndex {
FOREGROUND = 256,
BACKGROUND = 257,
CURSOR = 258
}
export interface IColorReportRequest {
type: ColorRequestType.REPORT;
index: AllColorIndex;
}
export interface IColorSetRequest {
type: ColorRequestType.SET;
index: AllColorIndex;
color: IColorRGB;
}
export interface IColorRestoreRequest {
type: ColorRequestType.RESTORE;
index?: AllColorIndex;
}
export type IColorEvent = (IColorReportRequest | IColorSetRequest | IColorRestoreRequest)[];
/**
* Calls the parser and handles actions generated by the parser.
*/
+1 -1
View File
@@ -4,7 +4,7 @@
*/
import { assert } from 'chai';
import { DEFAULT_ATTR_DATA } from './buffer/BufferLine';
import { DEFAULT_ATTR_DATA } from './primitives/buffer/BufferLine';
import { updateWindowsModeWrappedState } from './WindowsMode';
import { BufferService } from './services/BufferService';
import { OptionsService } from './services/OptionsService';
+1 -1
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from './buffer/Constants';
import { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from './primitives/buffer/Constants';
import { IBufferService } from './services/Services';
export function updateWindowsModeWrappedState(bufferService: IBufferService): void {
@@ -6,9 +6,9 @@
* Simplified from VS Code's lifecycle.ts - no tracking/leak detection.
*/
export interface IDisposable {
dispose(): void;
}
import type { IDisposable } from './Types';
export type { IDisposable };
export function toDisposable(fn: () => void): IDisposable {
return { dispose: fn };

Some files were not shown because too many files have changed in this diff Show More