Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3395d051a9 | ||
|
|
31b8409120 | ||
|
|
3eca55a80d |
@@ -25,4 +25,4 @@ When writing benchmark instructions:
|
|||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- Benchmarks run from built JS in `out-test/benchmark/*.benchmark.js`.
|
- Benchmarks run from built JS in `out-test/benchmark/*.benchmark.js`.
|
||||||
- Keep `NODE_PATH=./out` (handled by the npm script).
|
- Benchmark sources import compiled modules from `../../out/common/` and `../../out/browser/` (run `npm run build` first).
|
||||||
|
|||||||
+1
-3
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"import",
|
|
||||||
"typescript"
|
"typescript"
|
||||||
],
|
],
|
||||||
"categories": {
|
"categories": {
|
||||||
@@ -105,8 +104,7 @@
|
|||||||
"typescript/no-wrapper-object-types": "error",
|
"typescript/no-wrapper-object-types": "error",
|
||||||
"typescript/prefer-as-const": "error",
|
"typescript/prefer-as-const": "error",
|
||||||
"typescript/prefer-namespace-keyword": "error",
|
"typescript/prefer-namespace-keyword": "error",
|
||||||
"typescript/triple-slash-reference": "error",
|
"typescript/triple-slash-reference": "error"
|
||||||
"import/no-cycle": "error"
|
|
||||||
},
|
},
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -74,14 +74,14 @@ export class FitAddon implements ITerminalAddon, IFitApi {
|
|||||||
: (this._terminal.options.scrollbar?.width ?? ViewportConstants.DEFAULT_SCROLL_BAR_WIDTH));
|
: (this._terminal.options.scrollbar?.width ?? ViewportConstants.DEFAULT_SCROLL_BAR_WIDTH));
|
||||||
|
|
||||||
const parentElementStyle = _getComputedStyle(this._terminal.element.parentElement);
|
const parentElementStyle = _getComputedStyle(this._terminal.element.parentElement);
|
||||||
const parentElementHeight = Math.max(0, parseInt(parentElementStyle.getPropertyValue('height'), 10) || 0);
|
const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height'));
|
||||||
const parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width'), 10) || 0);
|
const parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width')));
|
||||||
const elementStyle = _getComputedStyle(this._terminal.element);
|
const elementStyle = _getComputedStyle(this._terminal.element);
|
||||||
const elementPadding = {
|
const elementPadding = {
|
||||||
top: parseInt(elementStyle.getPropertyValue('padding-top'), 10) || 0,
|
top: parseInt(elementStyle.getPropertyValue('padding-top')),
|
||||||
bottom: parseInt(elementStyle.getPropertyValue('padding-bottom'), 10) || 0,
|
bottom: parseInt(elementStyle.getPropertyValue('padding-bottom')),
|
||||||
right: parseInt(elementStyle.getPropertyValue('padding-right'), 10) || 0,
|
right: parseInt(elementStyle.getPropertyValue('padding-right')),
|
||||||
left: parseInt(elementStyle.getPropertyValue('padding-left'), 10) || 0
|
left: parseInt(elementStyle.getPropertyValue('padding-left'))
|
||||||
};
|
};
|
||||||
const elementPaddingVer = elementPadding.top + elementPadding.bottom;
|
const elementPaddingVer = elementPadding.top + elementPadding.bottom;
|
||||||
const elementPaddingHor = elementPadding.right + elementPadding.left;
|
const elementPaddingHor = elementPadding.right + elementPadding.left;
|
||||||
|
|||||||
@@ -222,8 +222,8 @@ export class IIPHandler implements IOscHandler, IResetHandler {
|
|||||||
|
|
||||||
private _dim(s: string, total: number, cdim: number): number {
|
private _dim(s: string, total: number, cdim: number): number {
|
||||||
if (s === 'auto') return 0;
|
if (s === 'auto') return 0;
|
||||||
if (s.endsWith('%')) return parseInt(s.slice(0, -1), 10) * total / 100;
|
if (s.endsWith('%')) return parseInt(s.slice(0, -1)) * total / 100;
|
||||||
if (s.endsWith('px')) return parseInt(s.slice(0, -2), 10);
|
if (s.endsWith('px')) return parseInt(s.slice(0, -2));
|
||||||
return parseInt(s, 10) * cdim;
|
return parseInt(s) * cdim;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ import { IDisposable, IMarker, Terminal } from '@xterm/xterm';
|
|||||||
import { Attributes, BgFlags, Content, ExtFlags, UnderlineStyle } from 'common/buffer/Constants';
|
import { Attributes, BgFlags, Content, ExtFlags, UnderlineStyle } from 'common/buffer/Constants';
|
||||||
import type { AttributeData } from 'common/buffer/AttributeData';
|
import type { AttributeData } from 'common/buffer/AttributeData';
|
||||||
import type { IParams, IDcsHandler, IOscHandler, IApcHandler, IEscapeSequenceParser } from 'common/parser/Types';
|
import type { IParams, IDcsHandler, IOscHandler, IApcHandler, IEscapeSequenceParser } from 'common/parser/Types';
|
||||||
import type { IInputHandler } from 'common/Types';
|
import type { IBufferLine, IExtendedAttrs, IInputHandler } from 'common/Types';
|
||||||
import type { IBufferLine, IExtendedAttrs } from 'common/buffer/Types';
|
|
||||||
import type { ITerminal, ReadonlyColorSet } from 'browser/Types';
|
import type { ITerminal, ReadonlyColorSet } from 'browser/Types';
|
||||||
import type { IRenderDimensions } from 'browser/renderer/shared/Types';
|
import type { IRenderDimensions } from 'browser/renderer/shared/Types';
|
||||||
import type { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
|
import type { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ export function parseKittyCommand(data: string): IKittyCommand {
|
|||||||
cmd.deleteSelector = value;
|
cmd.deleteSelector = value;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const numValue = parseInt(value, 10);
|
const numValue = parseInt(value);
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case KittyKey.FORMAT: cmd.format = numValue; break;
|
case KittyKey.FORMAT: cmd.format = numValue; break;
|
||||||
case KittyKey.ID: cmd.id = numValue; break;
|
case KittyKey.ID: cmd.id = numValue; break;
|
||||||
|
|||||||
@@ -7,8 +7,7 @@
|
|||||||
|
|
||||||
import type { IBuffer, IBufferCell, IBufferRange, ITerminalAddon, Terminal } from '@xterm/xterm';
|
import type { IBuffer, IBufferCell, IBufferRange, ITerminalAddon, Terminal } from '@xterm/xterm';
|
||||||
import type { IHTMLSerializeOptions, SerializeAddon as ISerializeApi, ISerializeOptions, ISerializeRange } from '@xterm/addon-serialize';
|
import type { IHTMLSerializeOptions, SerializeAddon as ISerializeApi, ISerializeOptions, ISerializeRange } from '@xterm/addon-serialize';
|
||||||
import { IColor } from 'common/Types';
|
import { IAttributeData, IColor } from 'common/Types';
|
||||||
import { IAttributeData } from 'common/buffer/Types';
|
|
||||||
import { DEFAULT_ANSI_COLORS } from 'browser/Types';
|
import { DEFAULT_ANSI_COLORS } from 'browser/Types';
|
||||||
import { UnderlineStyle } from 'common/buffer/Constants';
|
import { UnderlineStyle } from 'common/buffer/Constants';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
|
|||||||
import { ReadonlyColorSet } from 'browser/Types';
|
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/buffer/Constants';
|
||||||
import { IDecorationService, IOptionsService } from 'common/services/Services';
|
import { IDecorationService, IOptionsService } from 'common/services/Services';
|
||||||
import { ICellData } from 'common/buffer/Types';
|
import { ICellData } from 'common/Types';
|
||||||
import { Terminal } from '@xterm/xterm';
|
import { Terminal } from '@xterm/xterm';
|
||||||
import { rgba } from 'common/Color';
|
import { rgba } from 'common/Color';
|
||||||
import { treatGlyphAsBackgroundColor } from 'browser/renderer/shared/RendererUtils';
|
import { treatGlyphAsBackgroundColor } from 'browser/renderer/shared/RendererUtils';
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { CursorBlinkStateManager } from './CursorBlinkStateManager';
|
|||||||
import { observeDevicePixelDimensions } from './DevicePixelObserver';
|
import { observeDevicePixelDimensions } from './DevicePixelObserver';
|
||||||
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/shared/Types';
|
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/shared/Types';
|
||||||
import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
|
import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
|
||||||
import { CharData, IBufferLine, ICellData } from 'common/buffer/Types';
|
import { CharData, IBufferLine, ICellData } from 'common/Types';
|
||||||
import { AttributeData } from 'common/buffer/AttributeData';
|
import { AttributeData } from 'common/buffer/AttributeData';
|
||||||
import { CellData } from 'common/buffer/CellData';
|
import { CellData } from 'common/buffer/CellData';
|
||||||
import { Attributes, Content, FgFlags, NULL_CELL_CHAR, NULL_CELL_CODE } from 'common/buffer/Constants';
|
import { Attributes, Content, FgFlags, NULL_CELL_CHAR, NULL_CELL_CODE } from 'common/buffer/Constants';
|
||||||
|
|||||||
@@ -221,8 +221,8 @@ function drawPathDefinitionCharacter(
|
|||||||
const rx = parseFloat(args[0]) * deviceCellWidth;
|
const rx = parseFloat(args[0]) * deviceCellWidth;
|
||||||
const ry = parseFloat(args[1]) * deviceCellHeight;
|
const ry = parseFloat(args[1]) * deviceCellHeight;
|
||||||
const xAxisRotation = parseFloat(args[2]) * Math.PI / 180;
|
const xAxisRotation = parseFloat(args[2]) * Math.PI / 180;
|
||||||
const largeArcFlag = parseInt(args[3], 10);
|
const largeArcFlag = parseInt(args[3]);
|
||||||
const sweepFlag = parseInt(args[4], 10);
|
const sweepFlag = parseInt(args[4]);
|
||||||
const x = xOffset + parseFloat(args[5]) * deviceCellWidth;
|
const x = xOffset + parseFloat(args[5]) * deviceCellWidth;
|
||||||
const y = yOffset + parseFloat(args[6]) * deviceCellHeight;
|
const y = yOffset + parseFloat(args[6]) * deviceCellHeight;
|
||||||
drawSvgArc(ctx, currentX, currentY, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y);
|
drawSvgArc(ctx, currentX, currentY, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y);
|
||||||
|
|||||||
Executable
+86
@@ -0,0 +1,86 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Copyright (c) 2026 The xterm.js authors. All rights reserved.
|
||||||
|
# @license MIT
|
||||||
|
set -euo pipefail
|
||||||
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||||
|
cd "$ROOT"
|
||||||
|
|
||||||
|
if [[ ! -f src/common/parser/wasm/transition_table.h ]]; then
|
||||||
|
npm run build
|
||||||
|
node bin/gen_parser_transition_table.mjs
|
||||||
|
fi
|
||||||
|
|
||||||
|
WASM_DIR=src/common/parser/wasm
|
||||||
|
OUT="$WASM_DIR/parser.wasm"
|
||||||
|
|
||||||
|
# Apple Clang (Xcode CLT) has no wasm32 target; prefer Homebrew LLVM when needed.
|
||||||
|
wasm_clang_has_target() {
|
||||||
|
"$1" --print-targets 2>/dev/null | grep -q 'wasm32'
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve_wasm_toolchain() {
|
||||||
|
local clang_bin=clang
|
||||||
|
if wasm_clang_has_target clang; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
local llvm_prefix=""
|
||||||
|
if command -v brew >/dev/null 2>&1; then
|
||||||
|
llvm_prefix="$(brew --prefix llvm 2>/dev/null || true)"
|
||||||
|
fi
|
||||||
|
for prefix in "$llvm_prefix" /opt/homebrew/opt/llvm /usr/local/opt/llvm; do
|
||||||
|
if [[ -n "$prefix" && -x "$prefix/bin/clang" ]] && wasm_clang_has_target "$prefix/bin/clang"; then
|
||||||
|
clang_bin="$prefix/bin/clang"
|
||||||
|
local lld_prefix=""
|
||||||
|
if command -v brew >/dev/null 2>&1; then
|
||||||
|
lld_prefix="$(brew --prefix lld 2>/dev/null || true)"
|
||||||
|
fi
|
||||||
|
for lld_dir in "$lld_prefix/bin" /opt/homebrew/opt/lld/bin /usr/local/opt/lld/bin; do
|
||||||
|
if [[ -n "$lld_dir" && -x "$lld_dir/lld" ]]; then
|
||||||
|
PATH="$lld_dir:$(dirname "$clang_bin"):$PATH"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
PATH="$(dirname "$clang_bin"):$PATH"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if ! wasm_clang_has_target "$clang_bin"; then
|
||||||
|
echo "error: no clang with wasm32 support found (macOS: brew install llvm lld)" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
WASM_CLANG="$clang_bin"
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve_wasm_toolchain
|
||||||
|
|
||||||
|
"$WASM_CLANG" --target=wasm32-unknown-unknown -O2 -nostdlib -fuse-ld=lld \
|
||||||
|
-Wl,--no-entry \
|
||||||
|
-Wl,--export-memory \
|
||||||
|
-Wl,--export=reset \
|
||||||
|
-Wl,--export=scan \
|
||||||
|
-Wl,--export=probe_action \
|
||||||
|
-Wl,--export=set_state \
|
||||||
|
-Wl,--export=sync_params_from \
|
||||||
|
-Wl,--export=export_params_to \
|
||||||
|
-Wl,--export=get_params_len \
|
||||||
|
-Wl,--export=get_subparams_len \
|
||||||
|
-Wl,--export=get_subparams_ptr \
|
||||||
|
-Wl,--export=get_subparams_idx_ptr \
|
||||||
|
-Wl,--export=get_input_ptr \
|
||||||
|
-Wl,--export=get_kinds_ptr \
|
||||||
|
-Wl,--export=get_starts_ptr \
|
||||||
|
-Wl,--export=get_lengths_ptr \
|
||||||
|
-Wl,--export=get_aux_ptr \
|
||||||
|
-Wl,--export=get_param_starts_ptr \
|
||||||
|
-Wl,--export=get_param_counts_ptr \
|
||||||
|
-Wl,--export=get_params_ptr \
|
||||||
|
-Wl,--export=get_state_ptr \
|
||||||
|
-Wl,--export=get_header_ptr \
|
||||||
|
-Wl,--initial-memory=67108864 \
|
||||||
|
-Wl,--max-memory=67108864 \
|
||||||
|
"$WASM_DIR/parser.c" -o "$OUT"
|
||||||
|
|
||||||
|
node bin/embed_parser_wasm.mjs
|
||||||
|
|
||||||
|
echo "Built $OUT"
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 The xterm.js authors. All rights reserved.
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { readFileSync, writeFileSync } from 'fs';
|
||||||
|
import { join, dirname } from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
const root = join(__dirname, '..');
|
||||||
|
const wasm = readFileSync(join(root, 'src/common/parser/wasm/parser.wasm'));
|
||||||
|
const b64 = wasm.toString('base64');
|
||||||
|
|
||||||
|
const out = `/**
|
||||||
|
* Copyright (c) 2026 The xterm.js authors. All rights reserved.
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
/** Base64-encoded parser.wasm (generated by bin/build_parser_wasm.sh) */
|
||||||
|
export const PARSER_WASM_BASE64 = '${b64}';\n`;
|
||||||
|
|
||||||
|
writeFileSync(join(root, 'src/common/parser/wasm/parser.wasm.embed.ts'), out);
|
||||||
|
console.info(`Embedded parser.wasm (${wasm.length} bytes)`);
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 The xterm.js authors. All rights reserved.
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
// @ts-check
|
||||||
|
import { writeFileSync } from 'fs';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
import { dirname, join } from 'path';
|
||||||
|
|
||||||
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
const root = join(__dirname, '..');
|
||||||
|
|
||||||
|
// Import compiled transition table
|
||||||
|
const { VT500_TRANSITION_TABLE } = await import(join(root, 'out/common/parser/EscapeSequenceParser.js'));
|
||||||
|
|
||||||
|
const table = VT500_TRANSITION_TABLE.table;
|
||||||
|
let out = '/* Auto-generated by bin/gen_parser_transition_table.mjs - do not edit */\n';
|
||||||
|
out += `#ifndef PARSER_TRANSITION_TABLE_H\n#define PARSER_TRANSITION_TABLE_H\n\n`;
|
||||||
|
out += `#include <stdint.h>\n\n`;
|
||||||
|
out += `#define PARSER_TABLE_SIZE ${table.length}\n\n`;
|
||||||
|
out += `static const uint16_t PARSER_TRANSITION_TABLE[PARSER_TABLE_SIZE] = {\n`;
|
||||||
|
for (let i = 0; i < table.length; i++) {
|
||||||
|
if (i % 16 === 0) out += ' ';
|
||||||
|
out += `0x${table[i].toString(16)}`;
|
||||||
|
out += i < table.length - 1 ? ', ' : '';
|
||||||
|
if (i % 16 === 15) out += '\n';
|
||||||
|
}
|
||||||
|
if (table.length % 16 !== 0) out += '\n';
|
||||||
|
out += `};\n\n#endif\n`;
|
||||||
|
|
||||||
|
const headerPath = join(root, 'src/common/parser/wasm/transition_table.h');
|
||||||
|
writeFileSync(headerPath, out);
|
||||||
|
console.info(`Wrote ${headerPath} (${table.length} entries)`);
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
"start": "node demo/start",
|
"start": "node demo/start",
|
||||||
"dev": "concurrently -k -p [{name}] -n tsc,esbuild,esbuild-demo-client,esbuild-demo-server,server -c blue,yellow,cyan,green,magenta \"npm:tsc-watch\" \"npm:esbuild-watch\" \"npm:esbuild-demo-client-watch\" \"npm:esbuild-demo-server-watch\" \"npm:start\"",
|
"dev": "concurrently -k -p [{name}] -n tsc,esbuild,esbuild-demo-client,esbuild-demo-server,server -c blue,yellow,cyan,green,magenta \"npm:tsc-watch\" \"npm:esbuild-watch\" \"npm:esbuild-demo-client-watch\" \"npm:esbuild-demo-server-watch\" \"npm:start\"",
|
||||||
"build": "npm run tsc",
|
"build": "npm run tsc",
|
||||||
|
"build:parser-wasm": "bash bin/build_parser_wasm.sh",
|
||||||
"watch": "npm run tsc-watch",
|
"watch": "npm run tsc-watch",
|
||||||
"tsc": "tsgo -b ./tsconfig.all.json",
|
"tsc": "tsgo -b ./tsconfig.all.json",
|
||||||
"tsc-watch": "tsgo -b -w ./tsconfig.all.json --preserveWatchOutput",
|
"tsc-watch": "tsgo -b -w ./tsconfig.all.json --preserveWatchOutput",
|
||||||
|
|||||||
@@ -505,7 +505,7 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
|
|||||||
this.textarea,
|
this.textarea,
|
||||||
parent.ownerDocument.defaultView ?? window,
|
parent.ownerDocument.defaultView ?? window,
|
||||||
// Force unsafe null in node.js environment for tests
|
// Force unsafe null in node.js environment for tests
|
||||||
this._document ?? ((typeof window !== 'undefined') ? window.document : null as any)
|
this._document ?? (typeof window !== 'undefined') ? window.document : null as any
|
||||||
));
|
));
|
||||||
this._instantiationService.setService(ICoreBrowserService, this._coreBrowserService);
|
this._instantiationService.setService(ICoreBrowserService, this._coreBrowserService);
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ import { OscLinkProvider } from './OscLinkProvider';
|
|||||||
import { ILink } from './Types';
|
import { ILink } from './Types';
|
||||||
import { createCellData, MockBufferService, MockOptionsService } from '../common/TestUtils.test';
|
import { createCellData, MockBufferService, MockOptionsService } from '../common/TestUtils.test';
|
||||||
import { IBufferService, IOscLinkService } from '../common/services/Services';
|
import { IBufferService, IOscLinkService } from '../common/services/Services';
|
||||||
import { IOscLinkData } from '../common/Types';
|
import { IBufferLine, IOscLinkData } from '../common/Types';
|
||||||
import { IBufferLine } from '../common/buffer/Types';
|
|
||||||
|
|
||||||
class TestOscLinkService implements IOscLinkService {
|
class TestOscLinkService implements IOscLinkService {
|
||||||
public serviceBrand: any;
|
public serviceBrand: any;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import { IBufferRange, ILink } from './Types';
|
import { IBufferRange, ILink } from './Types';
|
||||||
import { ILinkProvider } from './services/Services';
|
import { ILinkProvider } from './services/Services';
|
||||||
import { CellData } from '../common/buffer/CellData';
|
import { CellData } from '../common/buffer/CellData';
|
||||||
import { IBufferLine } from '../common/buffer/Types';
|
import { IBufferLine } from '../common/Types';
|
||||||
import { IBufferService, IOptionsService, IOscLinkService } from '../common/services/Services';
|
import { IBufferService, IOptionsService, IOscLinkService } from '../common/services/Services';
|
||||||
|
|
||||||
export class OscLinkProvider implements ILinkProvider {
|
export class OscLinkProvider implements ILinkProvider {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export class RenderDebouncer implements IRenderDebouncerWithCallback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public dispose(): void {
|
public dispose(): void {
|
||||||
if (this._animationFrame !== undefined) {
|
if (this._animationFrame) {
|
||||||
this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame);
|
this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame);
|
||||||
this._animationFrame = undefined;
|
this._animationFrame = undefined;
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ export class RenderDebouncer implements IRenderDebouncerWithCallback {
|
|||||||
|
|
||||||
public addRefreshCallback(callback: FrameRequestCallback): number {
|
public addRefreshCallback(callback: FrameRequestCallback): number {
|
||||||
this._refreshCallbacks.push(callback);
|
this._refreshCallbacks.push(callback);
|
||||||
if (this._animationFrame === undefined) {
|
if (!this._animationFrame) {
|
||||||
this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh());
|
this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh());
|
||||||
}
|
}
|
||||||
return this._animationFrame;
|
return this._animationFrame;
|
||||||
@@ -46,7 +46,7 @@ export class RenderDebouncer implements IRenderDebouncerWithCallback {
|
|||||||
this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart;
|
this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart;
|
||||||
this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd;
|
this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd;
|
||||||
|
|
||||||
if (this._animationFrame !== undefined) {
|
if (this._animationFrame) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { assert } from 'chai';
|
|||||||
import { DEFAULT_ATTR_DATA } from '../common/buffer/BufferLine';
|
import { DEFAULT_ATTR_DATA } from '../common/buffer/BufferLine';
|
||||||
import { CellData } from '../common/buffer/CellData';
|
import { CellData } from '../common/buffer/CellData';
|
||||||
import { MockUnicodeService, createCellData } from '../common/TestUtils.test';
|
import { MockUnicodeService, createCellData } from '../common/TestUtils.test';
|
||||||
import { IMarker } from '../common/buffer/Types';
|
import { IMarker } from '../common/Types';
|
||||||
|
|
||||||
const INIT_COLS = 80;
|
const INIT_COLS = 80;
|
||||||
const INIT_ROWS = 24;
|
const INIT_ROWS = 24;
|
||||||
|
|||||||
@@ -7,9 +7,8 @@ import { IDisposable, IMarker, ILinkProvider, IDecorationOptions, IDecoration, I
|
|||||||
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IMouseService, IRenderService, ISelectionService, IThemeService } from './services/Services';
|
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IMouseService, IRenderService, ISelectionService, IThemeService } from './services/Services';
|
||||||
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from './renderer/shared/Types';
|
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from './renderer/shared/Types';
|
||||||
import { IColorSet, ITerminal, ILinkifier2, IBrowser, IViewport, ICompositionHelper, CharacterJoinerHandler, IBufferRange, ReadonlyColorSet, IBufferElementProvider } from './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 { IBuffer, IBufferSet } from '../common/buffer/Types';
|
||||||
import { ICircularList } from '../common/CircularList';
|
import { IBufferLine, ICellData, IAttributeData, ICircularList, XtermListener, ICharset, ITerminalOptions, ColorIndex } from '../common/Types';
|
||||||
import { XtermListener, ICharset, ITerminalOptions, ColorIndex } from '../common/Types';
|
|
||||||
import { Buffer } from '../common/buffer/Buffer';
|
import { Buffer } from '../common/buffer/Buffer';
|
||||||
import * as Browser from '../common/Platform';
|
import * as Browser from '../common/Platform';
|
||||||
import { CoreBrowserTerminal } from './CoreBrowserTerminal';
|
import { CoreBrowserTerminal } from './CoreBrowserTerminal';
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IRenderDebouncer } from './Types';
|
|
||||||
|
|
||||||
const RENDER_DEBOUNCE_THRESHOLD_MS = 1000; // 1 Second
|
const RENDER_DEBOUNCE_THRESHOLD_MS = 1000; // 1 Second
|
||||||
|
|
||||||
|
import { IRenderDebouncer } from './Types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Debounces calls to update screen readers to update at most once configurable interval of time.
|
* Debounces calls to update screen readers to update at most once configurable interval of time.
|
||||||
*/
|
*/
|
||||||
@@ -31,9 +31,7 @@ export class TimeBasedDebouncer implements IRenderDebouncer {
|
|||||||
public dispose(): void {
|
public dispose(): void {
|
||||||
if (this._refreshTimeoutID) {
|
if (this._refreshTimeoutID) {
|
||||||
clearTimeout(this._refreshTimeoutID);
|
clearTimeout(this._refreshTimeoutID);
|
||||||
this._refreshTimeoutID = undefined;
|
|
||||||
}
|
}
|
||||||
this._additionalRefreshRequested = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void {
|
public refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void {
|
||||||
@@ -49,12 +47,7 @@ export class TimeBasedDebouncer implements IRenderDebouncer {
|
|||||||
// enough time to pass before refreshing again.
|
// enough time to pass before refreshing again.
|
||||||
const refreshRequestTime: number = performance.now();
|
const refreshRequestTime: number = performance.now();
|
||||||
if (refreshRequestTime - this._lastRefreshMs >= this._debounceThresholdMS) {
|
if (refreshRequestTime - this._lastRefreshMs >= this._debounceThresholdMS) {
|
||||||
// Enough time has elapsed since the last refresh; refresh immediately
|
// Enough time has lapsed since the last refresh; refresh immediately
|
||||||
if (this._refreshTimeoutID !== undefined) {
|
|
||||||
clearTimeout(this._refreshTimeoutID);
|
|
||||||
this._refreshTimeoutID = undefined;
|
|
||||||
this._additionalRefreshRequested = false;
|
|
||||||
}
|
|
||||||
this._lastRefreshMs = refreshRequestTime;
|
this._lastRefreshMs = refreshRequestTime;
|
||||||
this._innerRefresh();
|
this._innerRefresh();
|
||||||
} else if (!this._additionalRefreshRequested) {
|
} else if (!this._additionalRefreshRequested) {
|
||||||
|
|||||||
@@ -3,9 +3,8 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IColor, ITerminalOptions } from '../common/Types';
|
import { CharData, IColor, ICoreTerminal, ITerminalOptions } from '../common/Types';
|
||||||
import { CharData, IBuffer } from '../common/buffer/Types';
|
import { IBuffer } from '../common/buffer/Types';
|
||||||
import { ICoreTerminal } from '../common/CoreTerminal';
|
|
||||||
import { IDisposable, IRenderDimensions as IRenderDimensionsApi, Terminal as ITerminalApi } from '@xterm/xterm';
|
import { IDisposable, IRenderDimensions as IRenderDimensionsApi, Terminal as ITerminalApi } from '@xterm/xterm';
|
||||||
import { channels, css } from '../common/Color';
|
import { channels, css } from '../common/Color';
|
||||||
import type { IEvent } from '../common/Event';
|
import type { IEvent } from '../common/Event';
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
export function getCoordsRelativeToElement(window: Pick<Window, 'getComputedStyle'>, event: {clientX: number, clientY: number}, element: HTMLElement): [number, number] {
|
export function getCoordsRelativeToElement(window: Pick<Window, 'getComputedStyle'>, event: {clientX: number, clientY: number}, element: HTMLElement): [number, number] {
|
||||||
const rect = element.getBoundingClientRect();
|
const rect = element.getBoundingClientRect();
|
||||||
const elementStyle = window.getComputedStyle(element);
|
const elementStyle = window.getComputedStyle(element);
|
||||||
const leftPadding = parseInt(elementStyle.getPropertyValue('padding-left'), 10);
|
const leftPadding = parseInt(elementStyle.getPropertyValue('padding-left'));
|
||||||
const topPadding = parseInt(elementStyle.getPropertyValue('padding-top'), 10);
|
const topPadding = parseInt(elementStyle.getPropertyValue('padding-top'));
|
||||||
return [
|
return [
|
||||||
event.clientX - rect.left - leftPadding,
|
event.clientX - rect.left - leftPadding,
|
||||||
event.clientY - rect.top - topPadding
|
event.clientY - rect.top - topPadding
|
||||||
@@ -22,7 +22,7 @@ export function getCoordsRelativeToElement(window: Pick<Window, 'getComputedStyl
|
|||||||
* @param event The mouse event.
|
* @param event The mouse event.
|
||||||
* @param element The terminal's container element.
|
* @param element The terminal's container element.
|
||||||
* @param colCount The number of columns in the terminal.
|
* @param colCount The number of columns in the terminal.
|
||||||
* @param rowCount The number of rows in the terminal.
|
* @param rowCount The number of rows n the terminal.
|
||||||
* @param hasValidCharSize Whether there is a valid character size available.
|
* @param hasValidCharSize Whether there is a valid character size available.
|
||||||
* @param cssCellWidth The cell width device pixel render dimensions.
|
* @param cssCellWidth The cell width device pixel render dimensions.
|
||||||
* @param cssCellHeight The cell height device pixel render dimensions.
|
* @param cssCellHeight The cell height device pixel render dimensions.
|
||||||
@@ -37,6 +37,10 @@ export function getCoords(window: Pick<Window, 'getComputedStyle'>, event: Pick<
|
|||||||
}
|
}
|
||||||
|
|
||||||
const coords = getCoordsRelativeToElement(window, event, element);
|
const coords = getCoordsRelativeToElement(window, event, element);
|
||||||
|
if (!coords) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
coords[0] = Math.ceil((coords[0] + (isSelection ? cssCellWidth / 2 : 0)) / cssCellWidth);
|
coords[0] = Math.ceil((coords[0] + (isSelection ? cssCellWidth / 2 : 0)) / cssCellWidth);
|
||||||
coords[1] = Math.ceil(coords[1] / cssCellHeight);
|
coords[1] = Math.ceil(coords[1] / cssCellHeight);
|
||||||
|
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ function wrappedRowsForRow(currentRow: number, bufferService: IBufferService): n
|
|||||||
*/
|
*/
|
||||||
function horizontalDirection(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): Direction {
|
function horizontalDirection(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): Direction {
|
||||||
let startRow;
|
let startRow;
|
||||||
if (moveToRequestedRow(startY, targetY, bufferService, applicationCursor).length > 0) {
|
if (moveToRequestedRow(targetX, targetY, bufferService, applicationCursor).length > 0) {
|
||||||
startRow = targetY - wrappedRowsForRow(targetY, bufferService);
|
startRow = targetY - wrappedRowsForRow(targetY, bufferService);
|
||||||
} else {
|
} else {
|
||||||
startRow = startY;
|
startRow = startY;
|
||||||
|
|||||||
@@ -694,7 +694,7 @@ class CursorBlinkStateManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _clearIdleTimer(): void {
|
private _clearIdleTimer(): void {
|
||||||
if (this._idleTimeout !== undefined) {
|
if (this._idleTimeout) {
|
||||||
this._coreBrowserService.window.clearTimeout(this._idleTimeout);
|
this._coreBrowserService.window.clearTimeout(this._idleTimeout);
|
||||||
this._idleTimeout = undefined;
|
this._idleTimeout = undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ 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 { 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 { BufferLine, DEFAULT_ATTR_DATA } from '../../../common/buffer/BufferLine';
|
||||||
import { BufferLineStringCache } from '../../../common/buffer/BufferLineStringCache';
|
import { BufferLineStringCache } from '../../../common/buffer/BufferLineStringCache';
|
||||||
import { IBufferLine } from '../../../common/buffer/Types';
|
import { IBufferLine } from '../../../common/Types';
|
||||||
import { CellData } from '../../../common/buffer/CellData';
|
import { CellData } from '../../../common/buffer/CellData';
|
||||||
import { MockCoreService, MockDecorationService, MockOptionsService, createCellData, NULL_CELL_DATA } from '../../../common/TestUtils.test';
|
import { MockCoreService, MockDecorationService, MockOptionsService, createCellData, NULL_CELL_DATA } from '../../../common/TestUtils.test';
|
||||||
import { MockCharacterJoinerService, MockCoreBrowserService, MockThemeService } from '../../TestUtils.test';
|
import { MockCharacterJoinerService, MockCoreBrowserService, MockThemeService } from '../../TestUtils.test';
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IColor } from '../../../common/Types';
|
import { IBufferLine, ICellData, IColor } from '../../../common/Types';
|
||||||
import { IBufferLine, ICellData } from '../../../common/buffer/Types';
|
|
||||||
import { INVERTED_DEFAULT_COLOR } from '../shared/Constants';
|
import { INVERTED_DEFAULT_COLOR } from '../shared/Constants';
|
||||||
import { WHITESPACE_CELL_CHAR, Attributes } from '../../../common/buffer/Constants';
|
import { WHITESPACE_CELL_CHAR, Attributes } from '../../../common/buffer/Constants';
|
||||||
import { CellData } from '../../../common/buffer/CellData';
|
import { CellData } from '../../../common/buffer/CellData';
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ export class StandardWheelEvent {
|
|||||||
let shouldFactorDPR: boolean = false;
|
let shouldFactorDPR: boolean = false;
|
||||||
if (platform.isChrome) {
|
if (platform.isChrome) {
|
||||||
const chromeVersionMatch = navigator.userAgent.match(/Chrome\/(\d+)/);
|
const chromeVersionMatch = navigator.userAgent.match(/Chrome\/(\d+)/);
|
||||||
const chromeMajorVersion = chromeVersionMatch ? parseInt(chromeVersionMatch[1], 10) : 123;
|
const chromeMajorVersion = chromeVersionMatch ? parseInt(chromeVersionMatch[1]) : 123;
|
||||||
shouldFactorDPR = chromeMajorVersion <= 122;
|
shouldFactorDPR = chromeMajorVersion <= 122;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { ICharacterJoinerService } from './Services';
|
|||||||
import { CharacterJoinerService } from './CharacterJoinerService';
|
import { CharacterJoinerService } from './CharacterJoinerService';
|
||||||
import { BufferLine } from '../../common/buffer/BufferLine';
|
import { BufferLine } from '../../common/buffer/BufferLine';
|
||||||
import { BufferLineStringCache } from '../../common/buffer/BufferLineStringCache';
|
import { BufferLineStringCache } from '../../common/buffer/BufferLineStringCache';
|
||||||
import { IBufferLine } from '../../common/buffer/Types';
|
import { IBufferLine } from '../../common/Types';
|
||||||
import { CellData } from '../../common/buffer/CellData';
|
import { CellData } from '../../common/buffer/CellData';
|
||||||
import { MockBufferService, createCellData } from '../../common/TestUtils.test';
|
import { MockBufferService, createCellData } from '../../common/TestUtils.test';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CharData, IBufferLine, ICellData } from '../../common/buffer/Types';
|
import { IBufferLine, ICellData, CharData } from '../../common/Types';
|
||||||
import { ICharacterJoiner } from '../Types';
|
import { ICharacterJoiner } from '../Types';
|
||||||
import { AttributeData } from '../../common/buffer/AttributeData';
|
import { AttributeData } from '../../common/buffer/AttributeData';
|
||||||
import { WHITESPACE_CELL_CHAR, Content } from '../../common/buffer/Constants';
|
import { WHITESPACE_CELL_CHAR, Content } from '../../common/buffer/Constants';
|
||||||
|
|||||||
@@ -6,13 +6,14 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { SelectionService, SelectionMode } from './SelectionService';
|
import { SelectionService, SelectionMode } from './SelectionService';
|
||||||
import { SelectionModel } from '../selection/SelectionModel';
|
import { SelectionModel } from '../selection/SelectionModel';
|
||||||
import { IBuffer, IBufferLine } from '../../common/buffer/Types';
|
import { IBufferLine } from '../../common/Types';
|
||||||
import { MockBufferService, MockOptionsService, MockCoreService, MockMouseStateService, createCellData } from '../../common/TestUtils.test';
|
import { MockBufferService, MockOptionsService, MockCoreService, MockMouseStateService, createCellData } from '../../common/TestUtils.test';
|
||||||
import { BufferLine } from '../../common/buffer/BufferLine';
|
import { BufferLine } from '../../common/buffer/BufferLine';
|
||||||
import { BufferLineStringCache } from '../../common/buffer/BufferLineStringCache';
|
import { BufferLineStringCache } from '../../common/buffer/BufferLineStringCache';
|
||||||
import { IBufferService, IOptionsService } from '../../common/services/Services';
|
import { IBufferService, IOptionsService } from '../../common/services/Services';
|
||||||
import { MockCoreBrowserService, MockMouseService, MockRenderService } from '../TestUtils.test';
|
import { MockCoreBrowserService, MockMouseService, MockRenderService } from '../TestUtils.test';
|
||||||
import { CellData } from '../../common/buffer/CellData';
|
import { CellData } from '../../common/buffer/CellData';
|
||||||
|
import { IBuffer } from '../../common/buffer/Types';
|
||||||
import { IRenderService } from './Services';
|
import { IRenderService } from './Services';
|
||||||
|
|
||||||
const TEST_STRING_CACHE = new BufferLineStringCache();
|
const TEST_STRING_CACHE = new BufferLineStringCache();
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ import { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from
|
|||||||
import { ICoreBrowserService, IMouseCoordsService, IRenderService, ISelectionService } from './Services';
|
import { ICoreBrowserService, IMouseCoordsService, IRenderService, ISelectionService } from './Services';
|
||||||
import { Disposable, MutableDisposable, toDisposable } from '../../common/Lifecycle';
|
import { Disposable, MutableDisposable, toDisposable } from '../../common/Lifecycle';
|
||||||
import * as Browser from '../../common/Platform';
|
import * as Browser from '../../common/Platform';
|
||||||
import { IDisposable } from '../../common/Types';
|
import { IBufferLine, ICellData, IDisposable } from '../../common/Types';
|
||||||
import { IBuffer, IBufferLine, ICellData } from '../../common/buffer/Types';
|
|
||||||
import { getRangeLength } from '../../common/buffer/BufferRange';
|
import { getRangeLength } from '../../common/buffer/BufferRange';
|
||||||
import { CellData } from '../../common/buffer/CellData';
|
import { CellData } from '../../common/buffer/CellData';
|
||||||
|
import { IBuffer } from '../../common/buffer/Types';
|
||||||
import { IBufferService, ICoreService, IMouseStateService, IOptionsService } from '../../common/services/Services';
|
import { IBufferService, ICoreService, IMouseStateService, IOptionsService } from '../../common/services/Services';
|
||||||
import { Emitter } from '../../common/Event';
|
import { Emitter } from '../../common/Event';
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { ICircularList } from './Types';
|
||||||
import { Disposable } from './Lifecycle';
|
import { Disposable } from './Lifecycle';
|
||||||
import { Emitter, type IEvent } from './Event';
|
import { Emitter } from './Event';
|
||||||
|
|
||||||
export interface IInsertEvent {
|
export interface IInsertEvent {
|
||||||
index: number;
|
index: number;
|
||||||
@@ -16,28 +17,6 @@ export interface IDeleteEvent {
|
|||||||
amount: number;
|
amount: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICircularList<T> {
|
|
||||||
length: number;
|
|
||||||
maxLength: number;
|
|
||||||
isFull: boolean;
|
|
||||||
|
|
||||||
onDeleteEmitter: Emitter<IDeleteEvent>;
|
|
||||||
onDelete: IEvent<IDeleteEvent>;
|
|
||||||
onInsertEmitter: Emitter<IInsertEvent>;
|
|
||||||
onInsert: IEvent<IInsertEvent>;
|
|
||||||
onTrimEmitter: Emitter<number>;
|
|
||||||
onTrim: IEvent<number>;
|
|
||||||
|
|
||||||
get(index: number): T | undefined;
|
|
||||||
set(index: number, value: T): void;
|
|
||||||
push(value: T): void;
|
|
||||||
recycle(): T;
|
|
||||||
pop(): T | undefined;
|
|
||||||
splice(start: number, deleteCount: number, ...items: T[]): void;
|
|
||||||
trimStart(count: number): void;
|
|
||||||
shiftElements(start: number, count: number, offset: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a circular list; a list with a maximum size that wraps around when push is called,
|
* Represents a circular list; a list with a maximum size that wraps around when push is called,
|
||||||
* overriding values at the start of the list.
|
* overriding values at the start of the list.
|
||||||
|
|||||||
+3
-3
@@ -177,9 +177,9 @@ export namespace css {
|
|||||||
// Formats: rgb() or rgba()
|
// Formats: rgb() or rgba()
|
||||||
const rgbaMatch = css.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);
|
const rgbaMatch = css.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);
|
||||||
if (rgbaMatch) {
|
if (rgbaMatch) {
|
||||||
$r = parseInt(rgbaMatch[1], 10);
|
$r = parseInt(rgbaMatch[1]);
|
||||||
$g = parseInt(rgbaMatch[2], 10);
|
$g = parseInt(rgbaMatch[2]);
|
||||||
$b = parseInt(rgbaMatch[3], 10);
|
$b = parseInt(rgbaMatch[3]);
|
||||||
$a = Math.round((rgbaMatch[5] === undefined ? 1 : parseFloat(rgbaMatch[5])) * 0xFF);
|
$a = Math.round((rgbaMatch[5] === undefined ? 1 : parseFloat(rgbaMatch[5])) * 0xFF);
|
||||||
return channels.toColor($r, $g, $b, $a);
|
return channels.toColor($r, $g, $b, $a);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,20 +21,19 @@
|
|||||||
* http://linux.die.net/man/7/urxvt
|
* http://linux.die.net/man/7/urxvt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IInstantiationService, IOptionsService, IBufferService, ILogService, ICharsetService, ICoreService, IMouseStateService, IUnicodeService, LogLevelEnum, IOscLinkService } from './services/Services';
|
import { IInstantiationService, IOptionsService, IBufferService, ILogService, ICharsetService, ICoreService, IMouseStateService, IUnicodeService, LogLevelEnum, ITerminalOptions, IOscLinkService } from './services/Services';
|
||||||
import { InstantiationService } from './services/InstantiationService';
|
import { InstantiationService } from './services/InstantiationService';
|
||||||
import { LogService } from './services/LogService';
|
import { LogService } from './services/LogService';
|
||||||
import { BufferService, BufferServiceConstants } from './services/BufferService';
|
import { BufferService, BufferServiceConstants } from './services/BufferService';
|
||||||
import { OptionsService } from './services/OptionsService';
|
import { OptionsService } from './services/OptionsService';
|
||||||
import { IDisposable, IScrollEvent, ITerminalOptions, IParams } from './Types';
|
import { IDisposable, IAttributeData, ICoreTerminal, IScrollEvent } from './Types';
|
||||||
import { IAttributeData, IBufferSet } from './buffer/Types';
|
|
||||||
import { CoreService } from './services/CoreService';
|
import { CoreService } from './services/CoreService';
|
||||||
import { MouseStateService } from './services/MouseStateService';
|
import { MouseStateService } from './services/MouseStateService';
|
||||||
import { UnicodeV6 } from './input/UnicodeV6';
|
|
||||||
import { UnicodeService } from './services/UnicodeService';
|
import { UnicodeService } from './services/UnicodeService';
|
||||||
import { CharsetService } from './services/CharsetService';
|
import { CharsetService } from './services/CharsetService';
|
||||||
import { updateWindowsModeWrappedState } from './WindowsMode';
|
import { updateWindowsModeWrappedState } from './WindowsMode';
|
||||||
import { IFunctionIdentifier } from './parser/Types';
|
import { IFunctionIdentifier, IParams } from './parser/Types';
|
||||||
|
import { IBufferSet } from './buffer/Types';
|
||||||
import { InputHandler } from './InputHandler';
|
import { InputHandler } from './InputHandler';
|
||||||
import { WriteBuffer } from './input/WriteBuffer';
|
import { WriteBuffer } from './input/WriteBuffer';
|
||||||
import { OscLinkService } from './services/OscLinkService';
|
import { OscLinkService } from './services/OscLinkService';
|
||||||
@@ -44,20 +43,6 @@ import { Disposable, MutableDisposable, toDisposable } from './Lifecycle';
|
|||||||
// Only trigger this warning a single time per session
|
// Only trigger this warning a single time per session
|
||||||
let hasWriteSyncWarnHappened = false;
|
let hasWriteSyncWarnHappened = false;
|
||||||
|
|
||||||
export interface ICoreTerminal {
|
|
||||||
mouseStateService: IMouseStateService;
|
|
||||||
coreService: ICoreService;
|
|
||||||
optionsService: IOptionsService;
|
|
||||||
unicodeService: IUnicodeService;
|
|
||||||
buffers: IBufferSet;
|
|
||||||
options: Required<ITerminalOptions>;
|
|
||||||
registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise<boolean>): IDisposable;
|
|
||||||
registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise<boolean>): IDisposable;
|
|
||||||
registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise<boolean>): IDisposable;
|
|
||||||
registerOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
|
|
||||||
registerApcHandler(id: IFunctionIdentifier, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
|
|
||||||
}
|
|
||||||
|
|
||||||
export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
||||||
protected readonly _instantiationService: IInstantiationService;
|
protected readonly _instantiationService: IInstantiationService;
|
||||||
protected readonly _bufferService: IBufferService;
|
protected readonly _bufferService: IBufferService;
|
||||||
@@ -131,7 +116,6 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
|||||||
this.mouseStateService = this._register(this._instantiationService.createInstance(MouseStateService));
|
this.mouseStateService = this._register(this._instantiationService.createInstance(MouseStateService));
|
||||||
this._instantiationService.setService(IMouseStateService, this.mouseStateService);
|
this._instantiationService.setService(IMouseStateService, this.mouseStateService);
|
||||||
this.unicodeService = this._register(this._instantiationService.createInstance(UnicodeService));
|
this.unicodeService = this._register(this._instantiationService.createInstance(UnicodeService));
|
||||||
this.unicodeService.register(new UnicodeV6());
|
|
||||||
this._instantiationService.setService(IUnicodeService, this.unicodeService);
|
this._instantiationService.setService(IUnicodeService, this.unicodeService);
|
||||||
this._charsetService = this._instantiationService.createInstance(CharsetService);
|
this._charsetService = this._instantiationService.createInstance(CharsetService);
|
||||||
this._instantiationService.setService(ICharsetService, this._charsetService);
|
this._instantiationService.setService(ICharsetService, this._charsetService);
|
||||||
|
|||||||
@@ -5,8 +5,7 @@
|
|||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { InputHandler } from './InputHandler';
|
import { InputHandler } from './InputHandler';
|
||||||
import { IColorEvent, ColorRequestType, SpecialColorIndex } from './Types';
|
import { IBufferLine, IAttributeData, IColorEvent, ColorRequestType, SpecialColorIndex } from './Types';
|
||||||
import { IAttributeData, IBufferLine } from './buffer/Types';
|
|
||||||
import { DEFAULT_ATTR_DATA } from './buffer/BufferLine';
|
import { DEFAULT_ATTR_DATA } from './buffer/BufferLine';
|
||||||
import { CellData } from './buffer/CellData';
|
import { CellData } from './buffer/CellData';
|
||||||
import { Attributes, BgFlags, UnderlineStyle } from './buffer/Constants';
|
import { Attributes, BgFlags, UnderlineStyle } from './buffer/Constants';
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IInputHandler, IDisposable, IWindowOptions, IColorEvent, IParseStack, ColorIndex, ColorRequestType, SpecialColorIndex } from './Types';
|
import { IInputHandler, IAttributeData, IDisposable, IWindowOptions, IColorEvent, IParseStack, ColorIndex, ColorRequestType, SpecialColorIndex } from './Types';
|
||||||
import { IAttributeData, IBuffer } from './buffer/Types';
|
|
||||||
import { C0, C1 } from './data/EscapeSequences';
|
import { C0, C1 } from './data/EscapeSequences';
|
||||||
import { CHARSETS, DEFAULT_CHARSET } from './data/Charsets';
|
import { CHARSETS, DEFAULT_CHARSET } from './data/Charsets';
|
||||||
import { EscapeSequenceParser } from './parser/EscapeSequenceParser';
|
import { EscapeSequenceParser } from './parser/EscapeSequenceParser';
|
||||||
@@ -21,6 +20,7 @@ import { UnicodeService } from './services/UnicodeService';
|
|||||||
import { OscHandler } from './parser/OscParser';
|
import { OscHandler } from './parser/OscParser';
|
||||||
import { DcsHandler } from './parser/DcsParser';
|
import { DcsHandler } from './parser/DcsParser';
|
||||||
import { ApcHandler } from './parser/ApcParser';
|
import { ApcHandler } from './parser/ApcParser';
|
||||||
|
import { IBuffer } from './buffer/Types';
|
||||||
import { parseColor } from './input/XParseColor';
|
import { parseColor } from './input/XParseColor';
|
||||||
import { Emitter } from './Event';
|
import { Emitter } from './Event';
|
||||||
import { XTERM_VERSION } from './Version';
|
import { XTERM_VERSION } from './Version';
|
||||||
@@ -3065,7 +3065,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
const idx = slots.shift() as string;
|
const idx = slots.shift() as string;
|
||||||
const spec = slots.shift() as string;
|
const spec = slots.shift() as string;
|
||||||
if (/^\d+$/.exec(idx)) {
|
if (/^\d+$/.exec(idx)) {
|
||||||
const index = parseInt(idx, 10);
|
const index = parseInt(idx);
|
||||||
if (isValidColorIndex(index)) {
|
if (isValidColorIndex(index)) {
|
||||||
if (spec === '?') {
|
if (spec === '?') {
|
||||||
event.push({ type: ColorRequestType.REPORT, index });
|
event.push({ type: ColorRequestType.REPORT, index });
|
||||||
@@ -3228,7 +3228,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
const slots = data.split(';');
|
const slots = data.split(';');
|
||||||
for (let i = 0; i < slots.length; ++i) {
|
for (let i = 0; i < slots.length; ++i) {
|
||||||
if (/^\d+$/.exec(slots[i])) {
|
if (/^\d+$/.exec(slots[i])) {
|
||||||
const index = parseInt(slots[i], 10);
|
const index = parseInt(slots[i]);
|
||||||
if (isValidColorIndex(index)) {
|
if (isValidColorIndex(index)) {
|
||||||
event.push({ type: ColorRequestType.RESTORE, index });
|
event.push({ type: ColorRequestType.RESTORE, index });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export function getSafariVersion(): number {
|
|||||||
if (majorVersion === null || majorVersion.length < 2) {
|
if (majorVersion === null || majorVersion.length < 2) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return parseInt(majorVersion[1], 10);
|
return parseInt(majorVersion[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the users platform. We use this to interpret the meta key
|
// Find the users platform. We use this to interpret the meta key
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
import { IBufferService, ICoreService, ILogService, IOptionsService, ITerminalOptions, IMouseStateService, ICharsetService, UnicodeCharProperties, UnicodeCharWidth, IUnicodeService, IUnicodeVersionProvider, LogLevelEnum, IDecorationService, IInternalDecoration, IOscLinkService, type IBufferResizeEvent } from './services/Services';
|
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 { UnicodeService } from './services/UnicodeService';
|
||||||
import { DEFAULT_OPTIONS } from './services/OptionsService';
|
import { DEFAULT_OPTIONS } from './services/OptionsService';
|
||||||
import { IAttributeData, IBuffer, IBufferLine, IBufferSet, IExtendedAttrs } from './buffer/Types';
|
import { IBufferSet, IBuffer } from './buffer/Types';
|
||||||
import { BufferSet } from './buffer/BufferSet';
|
import { BufferSet } from './buffer/BufferSet';
|
||||||
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEventType, ICharset, IModes, IOscLinkData, IDisposable } from './Types';
|
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEventType, ICharset, IModes, IAttributeData, IOscLinkData, IDisposable, IBufferLine, IExtendedAttrs } from './Types';
|
||||||
import { UnicodeV6 } from './input/UnicodeV6';
|
import { UnicodeV6 } from './input/UnicodeV6';
|
||||||
import { IDecorationOptions, IDecoration } from '@xterm/xterm';
|
import { IDecorationOptions, IDecoration } from '@xterm/xterm';
|
||||||
import { Emitter, type IEvent } from './Event';
|
import { Emitter, type IEvent } from './Event';
|
||||||
|
|||||||
+182
-24
@@ -3,32 +3,26 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { IDeleteEvent, IInsertEvent } from './CircularList';
|
||||||
|
import { UnderlineStyle } from './buffer/Constants';
|
||||||
|
import { IBufferSet } from './buffer/Types';
|
||||||
|
import { IParams } from './parser/Types';
|
||||||
|
import { IMouseStateService, ICoreService, IOptionsService, IUnicodeService } from './services/Services';
|
||||||
import { IFunctionIdentifier, ITerminalOptions as IPublicTerminalOptions } from '@xterm/xterm';
|
import { IFunctionIdentifier, ITerminalOptions as IPublicTerminalOptions } from '@xterm/xterm';
|
||||||
import type { IEvent } from './Event';
|
import type { Emitter, IEvent } from './Event';
|
||||||
|
|
||||||
/** sequence params serialized to js arrays */
|
export interface ICoreTerminal {
|
||||||
export type ParamsArray = (number | number[])[];
|
mouseStateService: IMouseStateService;
|
||||||
|
coreService: ICoreService;
|
||||||
/** Interface of Params storage class. */
|
optionsService: IOptionsService;
|
||||||
export interface IParams {
|
unicodeService: IUnicodeService;
|
||||||
/** from ctor */
|
buffers: IBufferSet;
|
||||||
maxLength: number;
|
options: Required<ITerminalOptions>;
|
||||||
maxSubParamsLength: number;
|
registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise<boolean>): IDisposable;
|
||||||
|
registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise<boolean>): IDisposable;
|
||||||
/** param values and its length */
|
registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise<boolean>): IDisposable;
|
||||||
params: Int32Array;
|
registerOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
|
||||||
length: number;
|
registerApcHandler(id: IFunctionIdentifier, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
|
||||||
|
|
||||||
/** 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 {
|
export interface IDisposable {
|
||||||
@@ -68,6 +62,28 @@ export interface IScrollEvent {
|
|||||||
position: number;
|
position: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ICircularList<T> {
|
||||||
|
length: number;
|
||||||
|
maxLength: number;
|
||||||
|
isFull: boolean;
|
||||||
|
|
||||||
|
onDeleteEmitter: Emitter<IDeleteEvent>;
|
||||||
|
onDelete: IEvent<IDeleteEvent>;
|
||||||
|
onInsertEmitter: Emitter<IInsertEvent>;
|
||||||
|
onInsert: IEvent<IInsertEvent>;
|
||||||
|
onTrimEmitter: Emitter<number>;
|
||||||
|
onTrim: IEvent<number>;
|
||||||
|
|
||||||
|
get(index: number): T | undefined;
|
||||||
|
set(index: number, value: T): void;
|
||||||
|
push(value: T): void;
|
||||||
|
recycle(): T;
|
||||||
|
pop(): T | undefined;
|
||||||
|
splice(start: number, deleteCount: number, ...items: T[]): void;
|
||||||
|
trimStart(count: number): void;
|
||||||
|
shiftElements(start: number, count: number, offset: number): void;
|
||||||
|
}
|
||||||
|
|
||||||
export const enum KeyboardResultType {
|
export const enum KeyboardResultType {
|
||||||
SEND_KEY,
|
SEND_KEY,
|
||||||
SELECT_ALL,
|
SELECT_ALL,
|
||||||
@@ -85,12 +101,24 @@ export interface ICharset {
|
|||||||
[key: string]: string | undefined;
|
[key: string]: string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type CharData = [attr: number, char: string, width: number, code: number];
|
||||||
|
|
||||||
export interface IColor {
|
export interface IColor {
|
||||||
readonly css: string;
|
readonly css: string;
|
||||||
readonly rgba: number; // 32-bit int with rgba in each byte
|
readonly rgba: number; // 32-bit int with rgba in each byte
|
||||||
}
|
}
|
||||||
export type IColorRGB = [red: number, green: number, blue: number];
|
export type IColorRGB = [red: number, green: number, blue: number];
|
||||||
|
|
||||||
|
export interface IExtendedAttrs {
|
||||||
|
ext: number;
|
||||||
|
underlineStyle: UnderlineStyle;
|
||||||
|
underlineColor: number;
|
||||||
|
underlineVariantOffset: number;
|
||||||
|
urlId: number;
|
||||||
|
clone(): IExtendedAttrs;
|
||||||
|
isEmpty(): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tracks the current hyperlink. Since these are treated as extended attirbutes, these get passed on
|
* 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
|
* to the linkifier when anything is printed. Doing it this way ensures that even when the cursor
|
||||||
@@ -102,6 +130,136 @@ export interface IOscLinkData {
|
|||||||
uri: string;
|
uri: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An object that represents all attributes of a cell.
|
||||||
|
*/
|
||||||
|
export interface IAttributeData {
|
||||||
|
/**
|
||||||
|
* "fg" is a 32-bit unsigned integer that stores the foreground color of the cell in the 24 least
|
||||||
|
* significant bits and additional flags in the remaining 8 bits.
|
||||||
|
*/
|
||||||
|
fg: number;
|
||||||
|
/**
|
||||||
|
* "bg" is a 32-bit unsigned integer that stores the background color of the cell in the 24 least
|
||||||
|
* significant bits and additional flags in the remaining 8 bits.
|
||||||
|
*/
|
||||||
|
bg: number;
|
||||||
|
/**
|
||||||
|
* "extended", aka "ext", stores extended attributes beyond those available in fg and bg. This
|
||||||
|
* data is optional on a cell and encodes less common data.
|
||||||
|
*/
|
||||||
|
extended: IExtendedAttrs;
|
||||||
|
|
||||||
|
clone(): IAttributeData;
|
||||||
|
|
||||||
|
// flags
|
||||||
|
isInverse(): number;
|
||||||
|
isBold(): number;
|
||||||
|
isUnderline(): number;
|
||||||
|
isBlink(): number;
|
||||||
|
isInvisible(): number;
|
||||||
|
isItalic(): number;
|
||||||
|
isDim(): number;
|
||||||
|
isStrikethrough(): number;
|
||||||
|
isProtected(): number;
|
||||||
|
isOverline(): number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The color mode of the foreground color which determines how to decode {@link getFgColor},
|
||||||
|
* possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
|
||||||
|
* {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
|
||||||
|
*/
|
||||||
|
getFgColorMode(): number;
|
||||||
|
/**
|
||||||
|
* The color mode of the background color which determines how to decode {@link getBgColor},
|
||||||
|
* possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
|
||||||
|
* {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
|
||||||
|
*/
|
||||||
|
getBgColorMode(): number;
|
||||||
|
isFgRGB(): boolean;
|
||||||
|
isBgRGB(): boolean;
|
||||||
|
isFgPalette(): boolean;
|
||||||
|
isBgPalette(): boolean;
|
||||||
|
isFgDefault(): boolean;
|
||||||
|
isBgDefault(): boolean;
|
||||||
|
isAttributeDefault(): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an integer representation of the foreground color, how to decode the color depends on the
|
||||||
|
* color mode {@link getFgColorMode}.
|
||||||
|
*/
|
||||||
|
getFgColor(): number;
|
||||||
|
/**
|
||||||
|
* Gets an integer representation of the background color, how to decode the color depends on the
|
||||||
|
* color mode {@link getBgColorMode}.
|
||||||
|
*/
|
||||||
|
getBgColor(): number;
|
||||||
|
|
||||||
|
// extended attrs
|
||||||
|
hasExtendedAttrs(): number;
|
||||||
|
updateExtended(): void;
|
||||||
|
getUnderlineColor(): number;
|
||||||
|
getUnderlineColorMode(): number;
|
||||||
|
isUnderlineColorRGB(): boolean;
|
||||||
|
isUnderlineColorPalette(): boolean;
|
||||||
|
isUnderlineColorDefault(): boolean;
|
||||||
|
getUnderlineStyle(): number;
|
||||||
|
getUnderlineVariantOffset(): number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Cell data */
|
||||||
|
export interface ICellData extends IAttributeData {
|
||||||
|
content: number;
|
||||||
|
combinedData: string;
|
||||||
|
isCombined(): number;
|
||||||
|
getWidth(): number;
|
||||||
|
getChars(): string;
|
||||||
|
getCode(): number;
|
||||||
|
setFromCharData(value: CharData): void;
|
||||||
|
getAsCharData(): CharData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for a line in the terminal buffer.
|
||||||
|
*/
|
||||||
|
export interface IBufferLine {
|
||||||
|
length: number;
|
||||||
|
isWrapped: boolean;
|
||||||
|
get(index: number): CharData;
|
||||||
|
set(index: number, value: CharData): void;
|
||||||
|
loadCell(index: number, cell: ICellData): ICellData;
|
||||||
|
setCell(index: number, cell: ICellData): void;
|
||||||
|
setCellFromCodepoint(index: number, codePoint: number, width: number, attrs: IAttributeData): void;
|
||||||
|
addCodepointToCell(index: number, codePoint: number, width: number): void;
|
||||||
|
insertCells(pos: number, n: number, ch: ICellData): void;
|
||||||
|
deleteCells(pos: number, n: number, fill: ICellData): void;
|
||||||
|
replaceCells(start: number, end: number, fill: ICellData, respectProtect?: boolean): void;
|
||||||
|
resize(cols: number, fill: ICellData): boolean;
|
||||||
|
cleanupMemory(): number;
|
||||||
|
fill(fillCellData: ICellData, respectProtect?: boolean): void;
|
||||||
|
copyFrom(line: IBufferLine): void;
|
||||||
|
clone(): IBufferLine;
|
||||||
|
getTrimmedLength(): number;
|
||||||
|
getNoBgTrimmedLength(): number;
|
||||||
|
translateToString(trimRight?: boolean, startCol?: number, endCol?: number, outColumns?: number[]): string;
|
||||||
|
|
||||||
|
/* direct access to cell attrs */
|
||||||
|
getWidth(index: number): number;
|
||||||
|
hasWidth(index: number): number;
|
||||||
|
getFg(index: number): number;
|
||||||
|
getBg(index: number): number;
|
||||||
|
hasContent(index: number): number;
|
||||||
|
getCodePoint(index: number): number;
|
||||||
|
isCombined(index: number): number;
|
||||||
|
getString(index: number): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IMarker extends IDisposable {
|
||||||
|
readonly id: number;
|
||||||
|
readonly isDisposed: boolean;
|
||||||
|
readonly line: number;
|
||||||
|
onDispose: IEvent<void>;
|
||||||
|
}
|
||||||
export interface IModes {
|
export interface IModes {
|
||||||
insertMode: boolean;
|
insertMode: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IColorRGB } from '../Types';
|
import { IAttributeData, IColorRGB, IExtendedAttrs } from '../Types';
|
||||||
import { IAttributeData, IExtendedAttrs } from './Types';
|
|
||||||
import { Attributes, FgFlags, BgFlags, UnderlineStyle, ExtFlags } from './Constants';
|
import { Attributes, FgFlags, BgFlags, UnderlineStyle, ExtFlags } from './Constants';
|
||||||
|
|
||||||
export class AttributeData implements IAttributeData {
|
export class AttributeData implements IAttributeData {
|
||||||
|
|||||||
@@ -6,8 +6,7 @@
|
|||||||
import { CircularList, IInsertEvent } from '../CircularList';
|
import { CircularList, IInsertEvent } from '../CircularList';
|
||||||
import { Disposable, toDisposable } from '../Lifecycle';
|
import { Disposable, toDisposable } from '../Lifecycle';
|
||||||
import { IdleTaskQueue } from '../TaskQueue';
|
import { IdleTaskQueue } from '../TaskQueue';
|
||||||
import { ICharset } from '../Types';
|
import { IAttributeData, IBufferLine, ICellData, ICharset } from '../Types';
|
||||||
import { IAttributeData, IBuffer, IBufferLine, ICellData } from './Types';
|
|
||||||
import { ExtendedAttrs } from './AttributeData';
|
import { ExtendedAttrs } from './AttributeData';
|
||||||
import { BufferLine, DEFAULT_ATTR_DATA } from './BufferLine';
|
import { BufferLine, DEFAULT_ATTR_DATA } from './BufferLine';
|
||||||
import { BufferLineStringCache } from './BufferLineStringCache';
|
import { BufferLineStringCache } from './BufferLineStringCache';
|
||||||
@@ -15,6 +14,7 @@ import { getWrappedLineTrimmedLength, reflowLargerApplyNewLayout, reflowLargerCr
|
|||||||
import { CellData } from './CellData';
|
import { CellData } from './CellData';
|
||||||
import { NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE, WHITESPACE_CELL_WIDTH } from './Constants';
|
import { NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE, WHITESPACE_CELL_WIDTH } from './Constants';
|
||||||
import { Marker } from './Marker';
|
import { Marker } from './Marker';
|
||||||
|
import { IBuffer } from './Types';
|
||||||
import { DEFAULT_CHARSET } from '../data/Charsets';
|
import { DEFAULT_CHARSET } from '../data/Charsets';
|
||||||
import { IBufferService, ILogService, IOptionsService } from '../services/Services';
|
import { IBufferService, ILogService, IOptionsService } from '../services/Services';
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE, DEFAULT_ATTR, Content,
|
|||||||
import { BufferLine } from './BufferLine';
|
import { BufferLine } from './BufferLine';
|
||||||
import { BufferLineStringCache } from './BufferLineStringCache';
|
import { BufferLineStringCache } from './BufferLineStringCache';
|
||||||
import { CellData } from './CellData';
|
import { CellData } from './CellData';
|
||||||
import { CharData, IBufferLine, ICellData } from './Types';
|
import { CharData, IBufferLine, ICellData } from '../Types';
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { AttributeData } from './AttributeData';
|
import { AttributeData } from './AttributeData';
|
||||||
import { createCellData, NULL_CELL_DATA, extendedAttributes } from '../TestUtils.test';
|
import { createCellData, NULL_CELL_DATA, extendedAttributes } from '../TestUtils.test';
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CharData, IAttributeData, IBufferLine, ICellData, IExtendedAttrs } from './Types';
|
import { CharData, IAttributeData, IBufferLine, ICellData, IExtendedAttrs } from '../Types';
|
||||||
import { AttributeData } from './AttributeData';
|
import { AttributeData } from './AttributeData';
|
||||||
import { CellData } from './CellData';
|
import { CellData } from './CellData';
|
||||||
import { Attributes, BgFlags, CHAR_DATA_ATTR_INDEX, CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, Content, NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR } from './Constants';
|
import { Attributes, BgFlags, CHAR_DATA_ATTR_INDEX, CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, Content, NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR } from './Constants';
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BufferLine } from './BufferLine';
|
import { BufferLine } from './BufferLine';
|
||||||
import { CircularList } from '../CircularList';
|
import { CircularList } from '../CircularList';
|
||||||
import { IBufferLine, ICellData } from './Types';
|
import { IBufferLine, ICellData } from '../Types';
|
||||||
|
|
||||||
export interface INewLayoutResult {
|
export interface INewLayoutResult {
|
||||||
layout: number[];
|
layout: number[];
|
||||||
|
|||||||
@@ -4,8 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Disposable, MutableDisposable } from '../Lifecycle';
|
import { Disposable, MutableDisposable } from '../Lifecycle';
|
||||||
|
import { IAttributeData } from '../Types';
|
||||||
import { Buffer } from './Buffer';
|
import { Buffer } from './Buffer';
|
||||||
import { IAttributeData, IBuffer, IBufferSet } from './Types';
|
import { IBuffer, IBufferSet } from './Types';
|
||||||
import { IBufferService, ILogService, IOptionsService } from '../services/Services';
|
import { IBufferService, ILogService, IOptionsService } from '../services/Services';
|
||||||
import { Emitter } from '../Event';
|
import { Emitter } from '../Event';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CharData, ICellData, IExtendedAttrs } from './Types';
|
import { CharData, ICellData, IExtendedAttrs } from '../Types';
|
||||||
import { stringFromCodePoint } from '../input/TextDecoder';
|
import { stringFromCodePoint } from '../input/TextDecoder';
|
||||||
import { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from './Constants';
|
import { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from './Constants';
|
||||||
import { AttributeData, ExtendedAttrs } from './AttributeData';
|
import { AttributeData, ExtendedAttrs } from './AttributeData';
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { dispose, IDisposable } from '../Lifecycle';
|
import { IDisposable, IMarker } from '../Types';
|
||||||
import { IMarker } from './Types';
|
|
||||||
import { Emitter } from '../Event';
|
import { Emitter } from '../Event';
|
||||||
|
import { dispose } from '../Lifecycle';
|
||||||
|
|
||||||
export class Marker implements IMarker {
|
export class Marker implements IMarker {
|
||||||
private static _nextId = 1;
|
private static _nextId = 1;
|
||||||
|
|||||||
+1
-147
@@ -3,158 +3,12 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { IAttributeData, ICircularList, IBufferLine, ICellData, IMarker, ICharset, IDisposable } from '../Types';
|
||||||
import type { IEvent } from '../Event';
|
import type { IEvent } from '../Event';
|
||||||
import type { ICircularList } from '../CircularList';
|
|
||||||
import type { ICharset } from '../Types';
|
|
||||||
import type { IDisposable } from '../Lifecycle';
|
|
||||||
import type { UnderlineStyle } from './Constants';
|
|
||||||
|
|
||||||
// BufferIndex denotes a position in the buffer: [rowIndex, colIndex]
|
// BufferIndex denotes a position in the buffer: [rowIndex, colIndex]
|
||||||
export type BufferIndex = [number, number];
|
export type BufferIndex = [number, number];
|
||||||
|
|
||||||
export type CharData = [attr: number, char: string, width: number, code: number];
|
|
||||||
|
|
||||||
export interface IExtendedAttrs {
|
|
||||||
ext: number;
|
|
||||||
underlineStyle: UnderlineStyle;
|
|
||||||
underlineColor: number;
|
|
||||||
underlineVariantOffset: number;
|
|
||||||
urlId: number;
|
|
||||||
clone(): IExtendedAttrs;
|
|
||||||
isEmpty(): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An object that represents all attributes of a cell.
|
|
||||||
*/
|
|
||||||
export interface IAttributeData {
|
|
||||||
/**
|
|
||||||
* "fg" is a 32-bit unsigned integer that stores the foreground color of the cell in the 24 least
|
|
||||||
* significant bits and additional flags in the remaining 8 bits.
|
|
||||||
*/
|
|
||||||
fg: number;
|
|
||||||
/**
|
|
||||||
* "bg" is a 32-bit unsigned integer that stores the background color of the cell in the 24 least
|
|
||||||
* significant bits and additional flags in the remaining 8 bits.
|
|
||||||
*/
|
|
||||||
bg: number;
|
|
||||||
/**
|
|
||||||
* "extended", aka "ext", stores extended attributes beyond those available in fg and bg. This
|
|
||||||
* data is optional on a cell and encodes less common data.
|
|
||||||
*/
|
|
||||||
extended: IExtendedAttrs;
|
|
||||||
|
|
||||||
clone(): IAttributeData;
|
|
||||||
|
|
||||||
// flags
|
|
||||||
isInverse(): number;
|
|
||||||
isBold(): number;
|
|
||||||
isUnderline(): number;
|
|
||||||
isBlink(): number;
|
|
||||||
isInvisible(): number;
|
|
||||||
isItalic(): number;
|
|
||||||
isDim(): number;
|
|
||||||
isStrikethrough(): number;
|
|
||||||
isProtected(): number;
|
|
||||||
isOverline(): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color mode of the foreground color which determines how to decode {@link getFgColor},
|
|
||||||
* possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
|
|
||||||
* {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
|
|
||||||
*/
|
|
||||||
getFgColorMode(): number;
|
|
||||||
/**
|
|
||||||
* The color mode of the background color which determines how to decode {@link getBgColor},
|
|
||||||
* possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
|
|
||||||
* {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
|
|
||||||
*/
|
|
||||||
getBgColorMode(): number;
|
|
||||||
isFgRGB(): boolean;
|
|
||||||
isBgRGB(): boolean;
|
|
||||||
isFgPalette(): boolean;
|
|
||||||
isBgPalette(): boolean;
|
|
||||||
isFgDefault(): boolean;
|
|
||||||
isBgDefault(): boolean;
|
|
||||||
isAttributeDefault(): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets an integer representation of the foreground color, how to decode the color depends on the
|
|
||||||
* color mode {@link getFgColorMode}.
|
|
||||||
*/
|
|
||||||
getFgColor(): number;
|
|
||||||
/**
|
|
||||||
* Gets an integer representation of the background color, how to decode the color depends on the
|
|
||||||
* color mode {@link getBgColorMode}.
|
|
||||||
*/
|
|
||||||
getBgColor(): number;
|
|
||||||
|
|
||||||
// extended attrs
|
|
||||||
hasExtendedAttrs(): number;
|
|
||||||
updateExtended(): void;
|
|
||||||
getUnderlineColor(): number;
|
|
||||||
getUnderlineColorMode(): number;
|
|
||||||
isUnderlineColorRGB(): boolean;
|
|
||||||
isUnderlineColorPalette(): boolean;
|
|
||||||
isUnderlineColorDefault(): boolean;
|
|
||||||
getUnderlineStyle(): number;
|
|
||||||
getUnderlineVariantOffset(): number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Cell data */
|
|
||||||
export interface ICellData extends IAttributeData {
|
|
||||||
content: number;
|
|
||||||
combinedData: string;
|
|
||||||
isCombined(): number;
|
|
||||||
getWidth(): number;
|
|
||||||
getChars(): string;
|
|
||||||
getCode(): number;
|
|
||||||
setFromCharData(value: CharData): void;
|
|
||||||
getAsCharData(): CharData;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface for a line in the terminal buffer.
|
|
||||||
*/
|
|
||||||
export interface IBufferLine {
|
|
||||||
length: number;
|
|
||||||
isWrapped: boolean;
|
|
||||||
get(index: number): CharData;
|
|
||||||
set(index: number, value: CharData): void;
|
|
||||||
loadCell(index: number, cell: ICellData): ICellData;
|
|
||||||
setCell(index: number, cell: ICellData): void;
|
|
||||||
setCellFromCodepoint(index: number, codePoint: number, width: number, attrs: IAttributeData): void;
|
|
||||||
addCodepointToCell(index: number, codePoint: number, width: number): void;
|
|
||||||
insertCells(pos: number, n: number, ch: ICellData): void;
|
|
||||||
deleteCells(pos: number, n: number, fill: ICellData): void;
|
|
||||||
replaceCells(start: number, end: number, fill: ICellData, respectProtect?: boolean): void;
|
|
||||||
resize(cols: number, fill: ICellData): boolean;
|
|
||||||
cleanupMemory(): number;
|
|
||||||
fill(fillCellData: ICellData, respectProtect?: boolean): void;
|
|
||||||
copyFrom(line: IBufferLine): void;
|
|
||||||
clone(): IBufferLine;
|
|
||||||
getTrimmedLength(): number;
|
|
||||||
getNoBgTrimmedLength(): number;
|
|
||||||
translateToString(trimRight?: boolean, startCol?: number, endCol?: number, outColumns?: number[]): string;
|
|
||||||
|
|
||||||
/* direct access to cell attrs */
|
|
||||||
getWidth(index: number): number;
|
|
||||||
hasWidth(index: number): number;
|
|
||||||
getFg(index: number): number;
|
|
||||||
getBg(index: number): number;
|
|
||||||
hasContent(index: number): number;
|
|
||||||
getCodePoint(index: number): number;
|
|
||||||
isCombined(index: number): number;
|
|
||||||
getString(index: number): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IMarker extends IDisposable {
|
|
||||||
readonly id: number;
|
|
||||||
readonly isDisposed: boolean;
|
|
||||||
readonly line: number;
|
|
||||||
onDispose: IEvent<void>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IBuffer {
|
export interface IBuffer {
|
||||||
readonly lines: ICircularList<IBufferLine>;
|
readonly lines: ICircularList<IBufferLine>;
|
||||||
ydisp: number;
|
ydisp: number;
|
||||||
|
|||||||
@@ -132,7 +132,6 @@ export class UnicodeV6 implements IUnicodeVersionProvider {
|
|||||||
public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {
|
public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {
|
||||||
let width = this.wcwidth(codepoint);
|
let width = this.wcwidth(codepoint);
|
||||||
let shouldJoin = width === 0 && preceding !== 0;
|
let shouldJoin = width === 0 && preceding !== 0;
|
||||||
// HACK: Ideally this file would not depend on the service which uses it
|
|
||||||
if (shouldJoin) {
|
if (shouldJoin) {
|
||||||
const oldWidth = UnicodeService.extractWidth(preceding);
|
const oldWidth = UnicodeService.extractWidth(preceding);
|
||||||
if (oldWidth === 0) {
|
if (oldWidth === 0) {
|
||||||
|
|||||||
@@ -77,10 +77,10 @@ class TestEscapeSequenceParser extends EscapeSequenceParser {
|
|||||||
public get realParams(): IParams {
|
public get realParams(): IParams {
|
||||||
return this._params;
|
return this._params;
|
||||||
}
|
}
|
||||||
public get collect(): string {
|
public get collectStr(): string {
|
||||||
return this.identToString(this._collect);
|
return this.identToString(this._collect);
|
||||||
}
|
}
|
||||||
public set collect(value: string) {
|
public set collectStr(value: string) {
|
||||||
this._collect = 0;
|
this._collect = 0;
|
||||||
for (let i = 0; i < value.length; ++i) {
|
for (let i = 0; i < value.length; ++i) {
|
||||||
this._collect <<= 8;
|
this._collect <<= 8;
|
||||||
@@ -248,19 +248,19 @@ describe('EscapeSequenceParser', () => {
|
|||||||
assert.equal(parser.currentState, ParserState.GROUND);
|
assert.equal(parser.currentState, ParserState.GROUND);
|
||||||
assert.equal(parser.osc, '');
|
assert.equal(parser.osc, '');
|
||||||
assert.deepEqual(parser.params, [0]);
|
assert.deepEqual(parser.params, [0]);
|
||||||
assert.equal(parser.collect, '');
|
assert.equal(parser.collectStr, '');
|
||||||
});
|
});
|
||||||
it('reset states', () => {
|
it('reset states', () => {
|
||||||
parser.currentState = 124;
|
parser.currentState = 124;
|
||||||
parser.osc = '#';
|
parser.osc = '#';
|
||||||
parser.params = [123];
|
parser.params = [123];
|
||||||
parser.collect = '#';
|
parser.collectStr = '#';
|
||||||
|
|
||||||
parser.reset();
|
parser.reset();
|
||||||
assert.equal(parser.currentState, ParserState.GROUND);
|
assert.equal(parser.currentState, ParserState.GROUND);
|
||||||
assert.equal(parser.osc, '');
|
assert.equal(parser.osc, '');
|
||||||
assert.deepEqual(parser.params, [0]);
|
assert.deepEqual(parser.params, [0]);
|
||||||
assert.equal(parser.collect, '');
|
assert.equal(parser.collectStr, '');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('state transitions and actions', () => {
|
describe('state transitions and actions', () => {
|
||||||
@@ -327,11 +327,11 @@ describe('EscapeSequenceParser', () => {
|
|||||||
for (state in states) {
|
for (state in states) {
|
||||||
parser.currentState = state;
|
parser.currentState = state;
|
||||||
parser.params = [23];
|
parser.params = [23];
|
||||||
parser.collect = '#';
|
parser.collectStr = '#';
|
||||||
parse(parser, '\x1b');
|
parse(parser, '\x1b');
|
||||||
assert.equal(parser.currentState, ParserState.ESCAPE);
|
assert.equal(parser.currentState, ParserState.ESCAPE);
|
||||||
assert.deepEqual(parser.params, [0]);
|
assert.deepEqual(parser.params, [0]);
|
||||||
assert.equal(parser.collect, '');
|
assert.equal(parser.collectStr, '');
|
||||||
parser.reset();
|
parser.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -383,7 +383,7 @@ describe('EscapeSequenceParser', () => {
|
|||||||
parser.currentState = ParserState.ESCAPE;
|
parser.currentState = ParserState.ESCAPE;
|
||||||
parse(parser, collect[i]);
|
parse(parser, collect[i]);
|
||||||
assert.equal(parser.currentState, ParserState.ESCAPE_INTERMEDIATE);
|
assert.equal(parser.currentState, ParserState.ESCAPE_INTERMEDIATE);
|
||||||
assert.equal(parser.collect, collect[i]);
|
assert.equal(parser.collectStr, collect[i]);
|
||||||
parser.reset();
|
parser.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -419,7 +419,7 @@ describe('EscapeSequenceParser', () => {
|
|||||||
parser.currentState = ParserState.ESCAPE_INTERMEDIATE;
|
parser.currentState = ParserState.ESCAPE_INTERMEDIATE;
|
||||||
parse(parser, collect[i]);
|
parse(parser, collect[i]);
|
||||||
assert.equal(parser.currentState, ParserState.ESCAPE_INTERMEDIATE);
|
assert.equal(parser.currentState, ParserState.ESCAPE_INTERMEDIATE);
|
||||||
assert.equal(parser.collect, collect[i]);
|
assert.equal(parser.collectStr, collect[i]);
|
||||||
parser.reset();
|
parser.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -442,21 +442,21 @@ describe('EscapeSequenceParser', () => {
|
|||||||
// C0
|
// C0
|
||||||
parser.currentState = ParserState.ESCAPE;
|
parser.currentState = ParserState.ESCAPE;
|
||||||
parser.params = [123];
|
parser.params = [123];
|
||||||
parser.collect = '#';
|
parser.collectStr = '#';
|
||||||
parse(parser, '[');
|
parse(parser, '[');
|
||||||
assert.equal(parser.currentState, ParserState.CSI_ENTRY);
|
assert.equal(parser.currentState, ParserState.CSI_ENTRY);
|
||||||
assert.deepEqual(parser.params, [0]);
|
assert.deepEqual(parser.params, [0]);
|
||||||
assert.equal(parser.collect, '');
|
assert.equal(parser.collectStr, '');
|
||||||
parser.reset();
|
parser.reset();
|
||||||
// C1
|
// C1
|
||||||
for (state in states) {
|
for (state in states) {
|
||||||
parser.currentState = state;
|
parser.currentState = state;
|
||||||
parser.params = [123];
|
parser.params = [123];
|
||||||
parser.collect = '#';
|
parser.collectStr = '#';
|
||||||
parse(parser, '\x9b');
|
parse(parser, '\x9b');
|
||||||
assert.equal(parser.currentState, ParserState.CSI_ENTRY);
|
assert.equal(parser.currentState, ParserState.CSI_ENTRY);
|
||||||
assert.deepEqual(parser.params, [0]);
|
assert.deepEqual(parser.params, [0]);
|
||||||
assert.equal(parser.collect, '');
|
assert.equal(parser.collectStr, '');
|
||||||
parser.reset();
|
parser.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -517,7 +517,7 @@ describe('EscapeSequenceParser', () => {
|
|||||||
parser.currentState = ParserState.CSI_ENTRY;
|
parser.currentState = ParserState.CSI_ENTRY;
|
||||||
parse(parser, collect[i]);
|
parse(parser, collect[i]);
|
||||||
assert.equal(parser.currentState, ParserState.CSI_PARAM);
|
assert.equal(parser.currentState, ParserState.CSI_PARAM);
|
||||||
assert.equal(parser.collect, collect[i]);
|
assert.equal(parser.collectStr, collect[i]);
|
||||||
parser.reset();
|
parser.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -582,7 +582,7 @@ describe('EscapeSequenceParser', () => {
|
|||||||
parser.currentState = ParserState.CSI_ENTRY;
|
parser.currentState = ParserState.CSI_ENTRY;
|
||||||
parse(parser, collect[i]);
|
parse(parser, collect[i]);
|
||||||
assert.equal(parser.currentState, ParserState.CSI_INTERMEDIATE);
|
assert.equal(parser.currentState, ParserState.CSI_INTERMEDIATE);
|
||||||
assert.equal(parser.collect, collect[i]);
|
assert.equal(parser.collectStr, collect[i]);
|
||||||
parser.reset();
|
parser.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -593,7 +593,7 @@ describe('EscapeSequenceParser', () => {
|
|||||||
parser.currentState = ParserState.CSI_PARAM;
|
parser.currentState = ParserState.CSI_PARAM;
|
||||||
parse(parser, collect[i]);
|
parse(parser, collect[i]);
|
||||||
assert.equal(parser.currentState, ParserState.CSI_INTERMEDIATE);
|
assert.equal(parser.currentState, ParserState.CSI_INTERMEDIATE);
|
||||||
assert.equal(parser.collect, collect[i]);
|
assert.equal(parser.collectStr, collect[i]);
|
||||||
parser.reset();
|
parser.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -619,7 +619,7 @@ describe('EscapeSequenceParser', () => {
|
|||||||
parser.currentState = ParserState.CSI_INTERMEDIATE;
|
parser.currentState = ParserState.CSI_INTERMEDIATE;
|
||||||
parse(parser, collect[i]);
|
parse(parser, collect[i]);
|
||||||
assert.equal(parser.currentState, ParserState.CSI_INTERMEDIATE);
|
assert.equal(parser.currentState, ParserState.CSI_INTERMEDIATE);
|
||||||
assert.equal(parser.collect, collect[i]);
|
assert.equal(parser.collectStr, collect[i]);
|
||||||
parser.reset();
|
parser.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -848,7 +848,7 @@ describe('EscapeSequenceParser', () => {
|
|||||||
parser.currentState = ParserState.DCS_ENTRY;
|
parser.currentState = ParserState.DCS_ENTRY;
|
||||||
parse(parser, collect[i]);
|
parse(parser, collect[i]);
|
||||||
assert.equal(parser.currentState, ParserState.DCS_PARAM);
|
assert.equal(parser.currentState, ParserState.DCS_PARAM);
|
||||||
assert.equal(parser.collect, collect[i]);
|
assert.equal(parser.collectStr, collect[i]);
|
||||||
parser.reset();
|
parser.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -930,7 +930,7 @@ describe('EscapeSequenceParser', () => {
|
|||||||
parser.currentState = ParserState.DCS_ENTRY;
|
parser.currentState = ParserState.DCS_ENTRY;
|
||||||
parse(parser, collect[i]);
|
parse(parser, collect[i]);
|
||||||
assert.equal(parser.currentState, ParserState.DCS_INTERMEDIATE);
|
assert.equal(parser.currentState, ParserState.DCS_INTERMEDIATE);
|
||||||
assert.equal(parser.collect, collect[i]);
|
assert.equal(parser.collectStr, collect[i]);
|
||||||
parser.reset();
|
parser.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -941,7 +941,7 @@ describe('EscapeSequenceParser', () => {
|
|||||||
parser.currentState = ParserState.DCS_PARAM;
|
parser.currentState = ParserState.DCS_PARAM;
|
||||||
parse(parser, collect[i]);
|
parse(parser, collect[i]);
|
||||||
assert.equal(parser.currentState, ParserState.DCS_INTERMEDIATE);
|
assert.equal(parser.currentState, ParserState.DCS_INTERMEDIATE);
|
||||||
assert.equal(parser.collect, collect[i]);
|
assert.equal(parser.collectStr, collect[i]);
|
||||||
parser.reset();
|
parser.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -965,7 +965,7 @@ describe('EscapeSequenceParser', () => {
|
|||||||
parser.currentState = ParserState.DCS_INTERMEDIATE;
|
parser.currentState = ParserState.DCS_INTERMEDIATE;
|
||||||
parse(parser, collect[i]);
|
parse(parser, collect[i]);
|
||||||
assert.equal(parser.currentState, ParserState.DCS_INTERMEDIATE);
|
assert.equal(parser.currentState, ParserState.DCS_INTERMEDIATE);
|
||||||
assert.equal(parser.collect, collect[i]);
|
assert.equal(parser.collectStr, collect[i]);
|
||||||
parser.reset();
|
parser.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -976,7 +976,7 @@ describe('EscapeSequenceParser', () => {
|
|||||||
parser.currentState = ParserState.DCS_INTERMEDIATE;
|
parser.currentState = ParserState.DCS_INTERMEDIATE;
|
||||||
parse(parser, '\x20' + chars[i]);
|
parse(parser, '\x20' + chars[i]);
|
||||||
assert.equal(parser.currentState, ParserState.DCS_IGNORE);
|
assert.equal(parser.currentState, ParserState.DCS_IGNORE);
|
||||||
assert.equal(parser.collect, '\x20');
|
assert.equal(parser.collectStr, '\x20');
|
||||||
parser.reset();
|
parser.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1079,7 +1079,7 @@ describe('EscapeSequenceParser', () => {
|
|||||||
parser.currentState = ParserState.APC_ENTRY;
|
parser.currentState = ParserState.APC_ENTRY;
|
||||||
parse(parser, collect[i]);
|
parse(parser, collect[i]);
|
||||||
assert.equal(parser.currentState, ParserState.APC_INTERMEDIATE);
|
assert.equal(parser.currentState, ParserState.APC_INTERMEDIATE);
|
||||||
assert.equal(parser.collect, collect[i]);
|
assert.equal(parser.collectStr, collect[i]);
|
||||||
parser.reset();
|
parser.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import { Params } from './Params';
|
|||||||
import { OscParser } from './OscParser';
|
import { OscParser } from './OscParser';
|
||||||
import { DcsParser } from './DcsParser';
|
import { DcsParser } from './DcsParser';
|
||||||
import { ApcParser } from './ApcParser';
|
import { ApcParser } from './ApcParser';
|
||||||
|
import { parseWithWasmScanner } from './EscapeSequenceParserWasm';
|
||||||
|
import { WasmEscapeScanner } from './WasmEscapeScanner';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VT commands done by the parser
|
* VT commands done by the parser
|
||||||
@@ -269,6 +271,9 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
|
|||||||
protected _params: Params;
|
protected _params: Params;
|
||||||
protected _collect: number;
|
protected _collect: number;
|
||||||
|
|
||||||
|
public get collect(): number { return this._collect; }
|
||||||
|
public set collect(value: number) { this._collect = value; }
|
||||||
|
|
||||||
// handler lookup containers
|
// handler lookup containers
|
||||||
protected _printHandler: PrintHandlerType;
|
protected _printHandler: PrintHandlerType;
|
||||||
protected _executeHandlers: { [flag: number]: ExecuteHandlerType };
|
protected _executeHandlers: { [flag: number]: ExecuteHandlerType };
|
||||||
@@ -297,6 +302,15 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
|
|||||||
chunkPos: 0
|
chunkPos: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected _scanCache: {
|
||||||
|
opIndex: number;
|
||||||
|
stateBeforeScan?: number;
|
||||||
|
inputOffset?: number;
|
||||||
|
chunkStart?: number;
|
||||||
|
scan?: import('./ScanTypes').ScanResult;
|
||||||
|
data?: Uint32Array;
|
||||||
|
} = { opIndex: 0 };
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected readonly _transitions: TransitionTable = VT500_TRANSITION_TABLE
|
protected readonly _transitions: TransitionTable = VT500_TRANSITION_TABLE
|
||||||
) {
|
) {
|
||||||
@@ -494,12 +508,20 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
|
|||||||
*/
|
*/
|
||||||
public reset(): void {
|
public reset(): void {
|
||||||
this.currentState = this.initialState;
|
this.currentState = this.initialState;
|
||||||
|
WasmEscapeScanner.initSync();
|
||||||
|
WasmEscapeScanner.reset();
|
||||||
this._oscParser.reset();
|
this._oscParser.reset();
|
||||||
this._dcsParser.reset();
|
this._dcsParser.reset();
|
||||||
this._apcParser.reset();
|
this._apcParser.reset();
|
||||||
this._params.resetZdm();
|
this._params.resetZdm();
|
||||||
this._collect = 0;
|
this._collect = 0;
|
||||||
this.precedingJoinState = 0;
|
this.precedingJoinState = 0;
|
||||||
|
this._scanCache.opIndex = 0;
|
||||||
|
this._scanCache.inputOffset = 0;
|
||||||
|
this._scanCache.chunkStart = undefined;
|
||||||
|
this._scanCache.scan = undefined;
|
||||||
|
this._scanCache.data = undefined;
|
||||||
|
this._scanCache.stateBeforeScan = undefined;
|
||||||
// abort pending continuation from async handler
|
// abort pending continuation from async handler
|
||||||
// Here the RESET type indicates, that the next parse call will
|
// Here the RESET type indicates, that the next parse call will
|
||||||
// ignore any saved stack, instead continues sync with next codepoint from GROUND
|
// ignore any saved stack, instead continues sync with next codepoint from GROUND
|
||||||
@@ -572,363 +594,6 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
public parse(data: Uint32Array, length: number, promiseResult?: boolean): void | Promise<boolean> {
|
public parse(data: Uint32Array, length: number, promiseResult?: boolean): void | Promise<boolean> {
|
||||||
let code: number;
|
return parseWithWasmScanner(this as unknown as import('./EscapeSequenceParserWasm').IWasmParseHost, data, length, promiseResult, this._scanCache);
|
||||||
let transition: number;
|
|
||||||
let start = 0;
|
|
||||||
let handlerResult: void | boolean | Promise<boolean>;
|
|
||||||
|
|
||||||
// resume from async handler
|
|
||||||
if (this._parseStack.state) {
|
|
||||||
// allow sync parser reset even in continuation mode
|
|
||||||
// Note: can be used to recover parser from improper continuation error below
|
|
||||||
if (this._parseStack.state === ParserStackType.RESET) {
|
|
||||||
this._parseStack.state = ParserStackType.NONE;
|
|
||||||
start = this._parseStack.chunkPos + 1; // continue with next codepoint in GROUND
|
|
||||||
} else {
|
|
||||||
if (promiseResult === undefined || this._parseStack.state === ParserStackType.FAIL) {
|
|
||||||
/**
|
|
||||||
* Reject further parsing on improper continuation after pausing. This is a really bad
|
|
||||||
* condition with screwed up execution order and prolly messed up terminal state,
|
|
||||||
* therefore we exit hard with an exception and reject any further parsing.
|
|
||||||
*
|
|
||||||
* Note: With `Terminal.write` usage this exception should never occur, as the top level
|
|
||||||
* calls are guaranteed to handle async conditions properly. If you ever encounter this
|
|
||||||
* exception in your terminal integration it indicates, that you injected data chunks to
|
|
||||||
* `InputHandler.parse` or `EscapeSequenceParser.parse` synchronously without waiting for
|
|
||||||
* continuation of a running async handler.
|
|
||||||
*
|
|
||||||
* It is possible to get rid of this error by calling `reset`. But dont rely on that, as
|
|
||||||
* the pending async handler still might mess up the terminal later. Instead fix the
|
|
||||||
* faulty async handling, so this error will not be thrown anymore.
|
|
||||||
*/
|
|
||||||
this._parseStack.state = ParserStackType.FAIL;
|
|
||||||
throw new Error('improper continuation due to previous async handler, giving up parsing');
|
|
||||||
}
|
|
||||||
|
|
||||||
// we have to resume the old handler loop if:
|
|
||||||
// - return value of the promise was `false`
|
|
||||||
// - handlers are not exhausted yet
|
|
||||||
const handlers = this._parseStack.handlers;
|
|
||||||
let handlerPos = this._parseStack.handlerPos - 1;
|
|
||||||
switch (this._parseStack.state) {
|
|
||||||
case ParserStackType.CSI:
|
|
||||||
if (promiseResult === false && handlerPos > -1) {
|
|
||||||
for (; handlerPos >= 0; handlerPos--) {
|
|
||||||
handlerResult = (handlers as CsiHandlerType[])[handlerPos](this._params);
|
|
||||||
if (handlerResult === true) {
|
|
||||||
break;
|
|
||||||
} else if (handlerResult instanceof Promise) {
|
|
||||||
this._parseStack.handlerPos = handlerPos;
|
|
||||||
return handlerResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this._parseStack.handlers = [];
|
|
||||||
break;
|
|
||||||
case ParserStackType.ESC:
|
|
||||||
if (promiseResult === false && handlerPos > -1) {
|
|
||||||
for (; handlerPos >= 0; handlerPos--) {
|
|
||||||
handlerResult = (handlers as EscHandlerType[])[handlerPos]();
|
|
||||||
if (handlerResult === true) {
|
|
||||||
break;
|
|
||||||
} else if (handlerResult instanceof Promise) {
|
|
||||||
this._parseStack.handlerPos = handlerPos;
|
|
||||||
return handlerResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this._parseStack.handlers = [];
|
|
||||||
break;
|
|
||||||
case ParserStackType.DCS:
|
|
||||||
code = data[this._parseStack.chunkPos];
|
|
||||||
handlerResult = this._dcsParser.unhook(code !== 0x18 && code !== 0x1a, promiseResult);
|
|
||||||
if (handlerResult) {
|
|
||||||
return handlerResult;
|
|
||||||
}
|
|
||||||
if (code === 0x1b) this._parseStack.transition |= ParserState.ESCAPE;
|
|
||||||
this._params.resetZdm();
|
|
||||||
this._collect = 0;
|
|
||||||
break;
|
|
||||||
case ParserStackType.OSC:
|
|
||||||
code = data[this._parseStack.chunkPos];
|
|
||||||
handlerResult = this._oscParser.end(code !== 0x18 && code !== 0x1a, promiseResult);
|
|
||||||
if (handlerResult) {
|
|
||||||
return handlerResult;
|
|
||||||
}
|
|
||||||
if (code === 0x1b) this._parseStack.transition |= ParserState.ESCAPE;
|
|
||||||
this._params.resetZdm();
|
|
||||||
this._collect = 0;
|
|
||||||
break;
|
|
||||||
case ParserStackType.APC:
|
|
||||||
code = data[this._parseStack.chunkPos];
|
|
||||||
handlerResult = this._apcParser.end(code !== 0x18 && code !== 0x1a, promiseResult);
|
|
||||||
if (handlerResult) {
|
|
||||||
return handlerResult;
|
|
||||||
}
|
|
||||||
if (code === 0x1b) this._parseStack.transition |= ParserState.ESCAPE;
|
|
||||||
this._params.resetZdm();
|
|
||||||
this._collect = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// cleanup before continuing with the main sync loop
|
|
||||||
this._parseStack.state = ParserStackType.NONE;
|
|
||||||
start = this._parseStack.chunkPos + 1;
|
|
||||||
this.precedingJoinState = 0;
|
|
||||||
this.currentState = this._parseStack.transition & TableAccess.TRANSITION_STATE_MASK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// continue with main sync loop
|
|
||||||
|
|
||||||
// process input string
|
|
||||||
for (let i = start; i < length; ++i) {
|
|
||||||
code = data[i];
|
|
||||||
|
|
||||||
// EXE fast-path: common control bytes (0x00-0x17) in non-payload states
|
|
||||||
if (code < 0x18 && this.currentState <= ParserState.CSI_IGNORE) {
|
|
||||||
(this._executeHandlersArr[code] ?? this._executeHandlerFb)(code);
|
|
||||||
this.precedingJoinState = 0;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// CSI fast-path: collapse ESC [ into a single entry, parse params+final in a tight loop
|
|
||||||
if (code === 0x1b
|
|
||||||
&& this.currentState < ParserState.OSC_STRING
|
|
||||||
&& i + 2 < length && data[i + 1] === 0x5b
|
|
||||||
) {
|
|
||||||
this._params.resetZdm();
|
|
||||||
this._collect = 0;
|
|
||||||
let k = i + 2;
|
|
||||||
let ch = data[k];
|
|
||||||
if (ch >= 0x3c && ch <= 0x3f) {
|
|
||||||
this._collect = ch;
|
|
||||||
k++;
|
|
||||||
}
|
|
||||||
let csiDone = false;
|
|
||||||
for (; k < length; k++) {
|
|
||||||
ch = data[k];
|
|
||||||
if (ch >= 0x30 && ch <= 0x39) {
|
|
||||||
this._params.addDigit(ch - 48);
|
|
||||||
} else if (ch === 0x3b) {
|
|
||||||
this._params.addParam(0);
|
|
||||||
} else if (ch === 0x3a) {
|
|
||||||
this._params.addSubParam(-1);
|
|
||||||
} else if (ch >= 0x40 && ch <= 0x7e) {
|
|
||||||
const handlers = this._csiHandlers[this._collect << 8 | ch];
|
|
||||||
let j = handlers ? handlers.length - 1 : -1;
|
|
||||||
for (; j >= 0; j--) {
|
|
||||||
handlerResult = handlers[j](this._params);
|
|
||||||
if (handlerResult === true) {
|
|
||||||
break;
|
|
||||||
} else if (handlerResult instanceof Promise) {
|
|
||||||
transition = ParserAction.CSI_DISPATCH << TableAccess.TRANSITION_ACTION_SHIFT | ParserState.GROUND;
|
|
||||||
this._preserveStack(ParserStackType.CSI, handlers, j, transition, k);
|
|
||||||
return handlerResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (j < 0) {
|
|
||||||
this._csiHandlerFb(this._collect << 8 | ch, this._params);
|
|
||||||
}
|
|
||||||
this.precedingJoinState = 0;
|
|
||||||
i = k;
|
|
||||||
this.currentState = ParserState.GROUND;
|
|
||||||
csiDone = true;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!csiDone) {
|
|
||||||
i = k - 1;
|
|
||||||
this.currentState = ParserState.CSI_PARAM;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// normal transition & action lookup
|
|
||||||
transition = this._transitions.table[
|
|
||||||
this.currentState << TableAccess.INDEX_STATE_SHIFT |
|
|
||||||
(code < NON_ASCII_PRINTABLE ? code : NON_ASCII_PRINTABLE)
|
|
||||||
];
|
|
||||||
switch (transition >> TableAccess.TRANSITION_ACTION_SHIFT) {
|
|
||||||
case ParserAction.PRINT:
|
|
||||||
// Note: 0x20 (SP) is included, 0x7F (DEL) is excluded
|
|
||||||
let c = i;
|
|
||||||
const l4 = length - 4;
|
|
||||||
while (c < l4
|
|
||||||
&& data[++c] >= 0x20 && (data[c] <= 0x7e || data[c] >= NON_ASCII_PRINTABLE)
|
|
||||||
&& data[++c] >= 0x20 && (data[c] <= 0x7e || data[c] >= NON_ASCII_PRINTABLE)
|
|
||||||
&& data[++c] >= 0x20 && (data[c] <= 0x7e || data[c] >= NON_ASCII_PRINTABLE)
|
|
||||||
&& data[++c] >= 0x20 && (data[c] <= 0x7e || data[c] >= NON_ASCII_PRINTABLE)
|
|
||||||
) {}
|
|
||||||
if (c >= l4) {
|
|
||||||
while (c < length && data[c] >= 0x20 && (data[c] <= 0x7e || data[c] >= NON_ASCII_PRINTABLE)) {
|
|
||||||
c++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this._printHandler(data, i, c);
|
|
||||||
i = c - 1;
|
|
||||||
break;
|
|
||||||
case ParserAction.EXECUTE:
|
|
||||||
if (this._executeHandlers[code]) this._executeHandlers[code]();
|
|
||||||
else this._executeHandlerFb(code);
|
|
||||||
this.precedingJoinState = 0;
|
|
||||||
break;
|
|
||||||
case ParserAction.IGNORE:
|
|
||||||
break;
|
|
||||||
case ParserAction.ERROR:
|
|
||||||
const inject: IParsingState = this._errorHandler(
|
|
||||||
{
|
|
||||||
position: i,
|
|
||||||
code,
|
|
||||||
currentState: this.currentState,
|
|
||||||
collect: this._collect,
|
|
||||||
params: this._params,
|
|
||||||
abort: false
|
|
||||||
});
|
|
||||||
if (inject.abort) return;
|
|
||||||
// inject values: currently not implemented
|
|
||||||
break;
|
|
||||||
case ParserAction.CSI_DISPATCH:
|
|
||||||
// Trigger CSI Handler
|
|
||||||
const handlers = this._csiHandlers[this._collect << 8 | code];
|
|
||||||
let j = handlers ? handlers.length - 1 : -1;
|
|
||||||
for (; j >= 0; j--) {
|
|
||||||
// true means success and to stop bubbling
|
|
||||||
// a promise indicates an async handler that needs to finish before progressing
|
|
||||||
handlerResult = handlers[j](this._params);
|
|
||||||
if (handlerResult === true) {
|
|
||||||
break;
|
|
||||||
} else if (handlerResult instanceof Promise) {
|
|
||||||
this._preserveStack(ParserStackType.CSI, handlers, j, transition, i);
|
|
||||||
return handlerResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (j < 0) {
|
|
||||||
this._csiHandlerFb(this._collect << 8 | code, this._params);
|
|
||||||
}
|
|
||||||
this.precedingJoinState = 0;
|
|
||||||
break;
|
|
||||||
case ParserAction.PARAM:
|
|
||||||
// inner loop: digits (0x30 - 0x39) and ; (0x3b) and : (0x3a)
|
|
||||||
do {
|
|
||||||
switch (code) {
|
|
||||||
case 0x3b:
|
|
||||||
this._params.addParam(0); // ZDM
|
|
||||||
break;
|
|
||||||
case 0x3a:
|
|
||||||
this._params.addSubParam(-1);
|
|
||||||
break;
|
|
||||||
default: // 0x30 - 0x39
|
|
||||||
this._params.addDigit(code - 48);
|
|
||||||
}
|
|
||||||
} while (++i < length && (code = data[i]) > 0x2f && code < 0x3c);
|
|
||||||
i--;
|
|
||||||
break;
|
|
||||||
case ParserAction.COLLECT:
|
|
||||||
this._collect <<= 8;
|
|
||||||
this._collect |= code;
|
|
||||||
break;
|
|
||||||
case ParserAction.ESC_DISPATCH:
|
|
||||||
const handlersEsc = this._escHandlers[this._collect << 8 | code];
|
|
||||||
let jj = handlersEsc ? handlersEsc.length - 1 : -1;
|
|
||||||
for (; jj >= 0; jj--) {
|
|
||||||
// true means success and to stop bubbling
|
|
||||||
// a promise indicates an async handler that needs to finish before progressing
|
|
||||||
handlerResult = handlersEsc[jj]();
|
|
||||||
if (handlerResult === true) {
|
|
||||||
break;
|
|
||||||
} else if (handlerResult instanceof Promise) {
|
|
||||||
this._preserveStack(ParserStackType.ESC, handlersEsc, jj, transition, i);
|
|
||||||
return handlerResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (jj < 0) {
|
|
||||||
this._escHandlerFb(this._collect << 8 | code);
|
|
||||||
}
|
|
||||||
this.precedingJoinState = 0;
|
|
||||||
break;
|
|
||||||
case ParserAction.CLEAR:
|
|
||||||
this._params.resetZdm();
|
|
||||||
this._collect = 0;
|
|
||||||
break;
|
|
||||||
case ParserAction.DCS_HOOK:
|
|
||||||
this._dcsParser.hook(this._collect << 8 | code, this._params);
|
|
||||||
break;
|
|
||||||
case ParserAction.DCS_PUT:
|
|
||||||
// inner loop - exit DCS_PUT: 0x18, 0x1a, 0x1b, 0x7f, 0x80 - 0x9f
|
|
||||||
// unhook triggered by: 0x1b, 0x9c (success) and 0x18, 0x1a (abort)
|
|
||||||
for (let j = i + 1; ; ++j) {
|
|
||||||
if (j >= length || (code = data[j]) === 0x18 || code === 0x1a || code === 0x1b || (code > 0x7f && code < NON_ASCII_PRINTABLE)) {
|
|
||||||
this._dcsParser.put(data, i, j);
|
|
||||||
i = j - 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ParserAction.DCS_UNHOOK:
|
|
||||||
handlerResult = this._dcsParser.unhook(code !== 0x18 && code !== 0x1a);
|
|
||||||
if (handlerResult) {
|
|
||||||
this._preserveStack(ParserStackType.DCS, [], 0, transition, i);
|
|
||||||
return handlerResult;
|
|
||||||
}
|
|
||||||
if (code === 0x1b) transition |= ParserState.ESCAPE;
|
|
||||||
this._params.resetZdm();
|
|
||||||
this._collect = 0;
|
|
||||||
this.precedingJoinState = 0;
|
|
||||||
break;
|
|
||||||
case ParserAction.OSC_START:
|
|
||||||
this._oscParser.start();
|
|
||||||
break;
|
|
||||||
case ParserAction.OSC_PUT:
|
|
||||||
// inner loop: 0x20 (SP) included, 0x7F (DEL) included
|
|
||||||
for (let j = i + 1; ; j++) {
|
|
||||||
if (j >= length || (code = data[j]) < 0x20 || (code > 0x7f && code < NON_ASCII_PRINTABLE)) {
|
|
||||||
this._oscParser.put(data, i, j);
|
|
||||||
i = j - 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ParserAction.OSC_END:
|
|
||||||
handlerResult = this._oscParser.end(code !== 0x18 && code !== 0x1a);
|
|
||||||
if (handlerResult) {
|
|
||||||
this._preserveStack(ParserStackType.OSC, [], 0, transition, i);
|
|
||||||
return handlerResult;
|
|
||||||
}
|
|
||||||
if (code === 0x1b) transition |= ParserState.ESCAPE;
|
|
||||||
this._params.resetZdm();
|
|
||||||
this._collect = 0;
|
|
||||||
this.precedingJoinState = 0;
|
|
||||||
break;
|
|
||||||
case ParserAction.APC_START:
|
|
||||||
this._apcParser.start(this._collect << 8 | code);
|
|
||||||
break;
|
|
||||||
case ParserAction.APC_PUT:
|
|
||||||
// inner loop - exit APC_PUT: 0x18, 0x1a, 0x1b, 0x9c
|
|
||||||
// allowed: 00/08 .. 00/13, 02/00 .. 07/14 + NON_ASCII_PRINTABLE
|
|
||||||
for (let j = i + 1; ; ++j) {
|
|
||||||
if (j < length && (
|
|
||||||
(data[j] >= 0x20 && data[j] < 0x7f) || (data[j] >= 0x08 && data[j] < 0x0e) || data[j] >= NON_ASCII_PRINTABLE
|
|
||||||
)) continue;
|
|
||||||
this._apcParser.put(data, i, j);
|
|
||||||
i = j - 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ParserAction.APC_END:
|
|
||||||
handlerResult = this._apcParser.end(code !== 0x18 && code !== 0x1a);
|
|
||||||
if (handlerResult) {
|
|
||||||
this._preserveStack(ParserStackType.APC, [], 0, transition, i);
|
|
||||||
return handlerResult;
|
|
||||||
}
|
|
||||||
if (code === 0x1b) transition |= ParserState.ESCAPE;
|
|
||||||
this._params.resetZdm();
|
|
||||||
this._collect = 0;
|
|
||||||
this.precedingJoinState = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
this.currentState = transition & TableAccess.TRANSITION_STATE_MASK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,417 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 The xterm.js authors. All rights reserved.
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { ParserState } from './Constants';
|
||||||
|
import { Params } from './Params';
|
||||||
|
import { Op, ScanResult } from './ScanTypes';
|
||||||
|
import { WasmEscapeScanner } from './WasmEscapeScanner';
|
||||||
|
import {
|
||||||
|
CsiHandlerType,
|
||||||
|
EscHandlerType,
|
||||||
|
IParams,
|
||||||
|
IParsingState,
|
||||||
|
IParserStackState,
|
||||||
|
ParserStackType,
|
||||||
|
ResumableHandlersType
|
||||||
|
} from './Types';
|
||||||
|
|
||||||
|
export interface IWasmParseHost {
|
||||||
|
currentState: number;
|
||||||
|
collect: number;
|
||||||
|
precedingJoinState: number;
|
||||||
|
readonly _params: Params;
|
||||||
|
readonly _parseStack: IParserStackState;
|
||||||
|
readonly _csiHandlers: { [ident: number]: CsiHandlerType[] | undefined };
|
||||||
|
readonly _escHandlers: { [ident: number]: EscHandlerType[] | undefined };
|
||||||
|
readonly _executeHandlers: { [flag: number]: (() => void) | undefined };
|
||||||
|
readonly _executeHandlersArr: Array<((code: number) => void) | undefined>;
|
||||||
|
_csiHandlerFb(ident: number, params: IParams): void;
|
||||||
|
_escHandlerFb(ident: number): void;
|
||||||
|
_executeHandlerFb(code: number): void;
|
||||||
|
_printHandler(data: Uint32Array, start: number, end: number): void;
|
||||||
|
_oscParser: { start(): void; put(data: Uint32Array, start: number, end: number): void; end(success: boolean, promiseResult?: boolean): void | Promise<boolean> };
|
||||||
|
_dcsParser: { hook(ident: number, params: IParams): void; put(data: Uint32Array, start: number, end: number): void; unhook(success: boolean, promiseResult?: boolean): void | Promise<boolean> };
|
||||||
|
_apcParser: { start(ident: number): void; put(data: Uint32Array, start: number, end: number): void; end(success: boolean, promiseResult?: boolean): void | Promise<boolean> };
|
||||||
|
_preserveStack(state: ParserStackType, handlers: ResumableHandlersType, handlerPos: number, transition: number, chunkPos: number): void;
|
||||||
|
_errorHandler(state: IParsingState): IParsingState;
|
||||||
|
}
|
||||||
|
|
||||||
|
let wasmReady = false;
|
||||||
|
|
||||||
|
function ensureWasm(): void {
|
||||||
|
if (!wasmReady) {
|
||||||
|
WasmEscapeScanner.initSync();
|
||||||
|
wasmReady = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadParams(host: IWasmParseHost, scan: ScanResult, opIndex: number): void {
|
||||||
|
const start = scan.paramStarts[opIndex] ?? 0;
|
||||||
|
const count = scan.paramCounts[opIndex] ?? 0;
|
||||||
|
if (count === 0) {
|
||||||
|
host._params.resetZdm();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let idx = start;
|
||||||
|
host._params.resetZdm();
|
||||||
|
for (let p = 0; p < count; p++) {
|
||||||
|
const main = scan.params[idx++] | 0;
|
||||||
|
if (p === 0) {
|
||||||
|
host._params.params[0] = main;
|
||||||
|
host._params.length = 1;
|
||||||
|
} else {
|
||||||
|
host._params.addParam(main);
|
||||||
|
}
|
||||||
|
while (idx < scan.params.length && (scan.params[idx] & 0x80000000) !== 0) {
|
||||||
|
const sv = scan.params[idx++] & 0x7FFFFFFF;
|
||||||
|
host._params.addSubParam(sv === 0x7FFFFFFF ? -1 : sv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** True when a chunked WASM scan of `data` is still in progress (e.g. nested parse during print). */
|
||||||
|
function isActiveWasmParse(scanCache: IWasmScanCache, data: Uint32Array, length: number): boolean {
|
||||||
|
return scanCache.data === data
|
||||||
|
&& (scanCache.inputOffset ?? 0) < length
|
||||||
|
&& (scanCache.scan !== undefined || scanCache.chunkStart !== undefined);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function parseWithWasmScanner(
|
||||||
|
host: IWasmParseHost,
|
||||||
|
data: Uint32Array,
|
||||||
|
length: number,
|
||||||
|
promiseResult: boolean | undefined,
|
||||||
|
scanCache: IWasmScanCache
|
||||||
|
): void | Promise<boolean> {
|
||||||
|
ensureWasm();
|
||||||
|
|
||||||
|
// Resume async handler dispatch without rescanning
|
||||||
|
if (host._parseStack.state) {
|
||||||
|
return resumeWasmParse(host, data, length, promiseResult, scanCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isActiveWasmParse(scanCache, data, length)) {
|
||||||
|
scanCache.stateBeforeScan = host.currentState;
|
||||||
|
scanCache.inputOffset = 0;
|
||||||
|
scanCache.scan = undefined;
|
||||||
|
scanCache.opIndex = 0;
|
||||||
|
scanCache.data = undefined;
|
||||||
|
scanCache.chunkStart = undefined;
|
||||||
|
}
|
||||||
|
return runWasmScanChunks(host, data, length, promiseResult, scanCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IWasmScanCache {
|
||||||
|
scan?: ScanResult;
|
||||||
|
data?: Uint32Array;
|
||||||
|
opIndex: number;
|
||||||
|
stateBeforeScan?: number;
|
||||||
|
inputOffset?: number;
|
||||||
|
chunkStart?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
function runWasmScanChunks(
|
||||||
|
host: IWasmParseHost,
|
||||||
|
data: Uint32Array,
|
||||||
|
length: number,
|
||||||
|
promiseResult: boolean | undefined,
|
||||||
|
scanCache: IWasmScanCache
|
||||||
|
): void | Promise<boolean> {
|
||||||
|
let pos = scanCache.inputOffset ?? 0;
|
||||||
|
const stateBeforeScan = scanCache.stateBeforeScan ?? host.currentState;
|
||||||
|
|
||||||
|
while (pos < length) {
|
||||||
|
if (!scanCache.scan || scanCache.data !== data || scanCache.chunkStart !== pos) {
|
||||||
|
WasmEscapeScanner.syncParserState(host.currentState, host.collect, host._params);
|
||||||
|
const scan = WasmEscapeScanner.scan(data, length, pos);
|
||||||
|
scanCache.scan = scan;
|
||||||
|
scanCache.data = data;
|
||||||
|
scanCache.chunkStart = pos;
|
||||||
|
scanCache.opIndex = 0;
|
||||||
|
host.currentState = WasmEscapeScanner.currentState;
|
||||||
|
host.collect = WasmEscapeScanner.collect;
|
||||||
|
}
|
||||||
|
|
||||||
|
const scan = scanCache.scan;
|
||||||
|
if (!scan) {
|
||||||
|
throw new Error('Wasm parser scan cache missing during chunked parse');
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = dispatchScanOps(host, data, scan, scanCache.opIndex, scanCache, promiseResult, stateBeforeScan);
|
||||||
|
if (result instanceof Promise) {
|
||||||
|
scanCache.inputOffset = pos;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nextOffset = scan.nextOffset;
|
||||||
|
if (nextOffset <= pos) {
|
||||||
|
throw new Error(`Wasm parser scan did not advance (stuck at input offset ${pos})`);
|
||||||
|
}
|
||||||
|
pos = nextOffset;
|
||||||
|
scanCache.inputOffset = pos;
|
||||||
|
scanCache.scan = undefined;
|
||||||
|
scanCache.opIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
scanCache.inputOffset = length;
|
||||||
|
scanCache.scan = undefined;
|
||||||
|
scanCache.data = undefined;
|
||||||
|
scanCache.chunkStart = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resumeWasmParse(
|
||||||
|
host: IWasmParseHost,
|
||||||
|
data: Uint32Array,
|
||||||
|
length: number,
|
||||||
|
promiseResult: boolean | undefined,
|
||||||
|
scanCache: IWasmScanCache
|
||||||
|
): void | Promise<boolean> {
|
||||||
|
if (host._parseStack.state === ParserStackType.RESET) {
|
||||||
|
host._parseStack.state = ParserStackType.NONE;
|
||||||
|
scanCache.opIndex = host._parseStack.chunkPos + 1;
|
||||||
|
host._parseStack.chunkPos = 0;
|
||||||
|
if (!scanCache.scan || scanCache.data !== data) {
|
||||||
|
return parseWithWasmScanner(host, data, length, promiseResult, scanCache);
|
||||||
|
}
|
||||||
|
return runWasmScanChunks(host, data, length, promiseResult, scanCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (promiseResult === undefined || host._parseStack.state === ParserStackType.FAIL) {
|
||||||
|
host._parseStack.state = ParserStackType.FAIL;
|
||||||
|
throw new Error('improper continuation due to previous async handler, giving up parsing');
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlers = host._parseStack.handlers;
|
||||||
|
let handlerPos = host._parseStack.handlerPos - 1;
|
||||||
|
let handlerResult: void | boolean | Promise<boolean>;
|
||||||
|
const scan = scanCache.scan;
|
||||||
|
const opIndex = scanCache.opIndex;
|
||||||
|
|
||||||
|
if (!scan) {
|
||||||
|
throw new Error('missing scan cache on wasm parser resume');
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (host._parseStack.state) {
|
||||||
|
case ParserStackType.CSI:
|
||||||
|
if (promiseResult === false && handlerPos > -1) {
|
||||||
|
for (; handlerPos >= 0; handlerPos--) {
|
||||||
|
handlerResult = (handlers as CsiHandlerType[])[handlerPos](host._params);
|
||||||
|
if (handlerResult === true) break;
|
||||||
|
if (handlerResult instanceof Promise) {
|
||||||
|
host._parseStack.handlerPos = handlerPos;
|
||||||
|
return handlerResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
host._parseStack.handlers = [];
|
||||||
|
scanCache.opIndex = opIndex + 1;
|
||||||
|
break;
|
||||||
|
case ParserStackType.ESC:
|
||||||
|
if (promiseResult === false && handlerPos > -1) {
|
||||||
|
for (; handlerPos >= 0; handlerPos--) {
|
||||||
|
handlerResult = (handlers as EscHandlerType[])[handlerPos]();
|
||||||
|
if (handlerResult === true) break;
|
||||||
|
if (handlerResult instanceof Promise) {
|
||||||
|
host._parseStack.handlerPos = handlerPos;
|
||||||
|
return handlerResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
host._parseStack.handlers = [];
|
||||||
|
scanCache.opIndex = opIndex + 1;
|
||||||
|
break;
|
||||||
|
case ParserStackType.DCS: {
|
||||||
|
const code = data[host._parseStack.chunkPos];
|
||||||
|
handlerResult = host._dcsParser.unhook(code !== 0x18 && code !== 0x1a, promiseResult);
|
||||||
|
if (handlerResult) return handlerResult;
|
||||||
|
if (code === 0x1b) host.currentState = ParserState.ESCAPE;
|
||||||
|
host._params.resetZdm();
|
||||||
|
host.collect = 0;
|
||||||
|
scanCache.opIndex = opIndex + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ParserStackType.OSC: {
|
||||||
|
const code = data[host._parseStack.chunkPos];
|
||||||
|
handlerResult = host._oscParser.end(code !== 0x18 && code !== 0x1a, promiseResult);
|
||||||
|
if (handlerResult) return handlerResult;
|
||||||
|
if (code === 0x1b) host.currentState = ParserState.ESCAPE;
|
||||||
|
host._params.resetZdm();
|
||||||
|
host.collect = 0;
|
||||||
|
scanCache.opIndex = opIndex + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ParserStackType.APC: {
|
||||||
|
const code = data[host._parseStack.chunkPos];
|
||||||
|
handlerResult = host._apcParser.end(code !== 0x18 && code !== 0x1a, promiseResult);
|
||||||
|
if (handlerResult) return handlerResult;
|
||||||
|
if (code === 0x1b) host.currentState = ParserState.ESCAPE;
|
||||||
|
host._params.resetZdm();
|
||||||
|
host.collect = 0;
|
||||||
|
scanCache.opIndex = opIndex + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
host._parseStack.state = ParserStackType.NONE;
|
||||||
|
host.precedingJoinState = 0;
|
||||||
|
return runWasmScanChunks(host, data, length, promiseResult, scanCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
function dispatchScanOps(
|
||||||
|
host: IWasmParseHost,
|
||||||
|
data: Uint32Array,
|
||||||
|
scan: ScanResult,
|
||||||
|
fromOp: number,
|
||||||
|
scanCache: IWasmScanCache,
|
||||||
|
promiseResult: boolean | undefined,
|
||||||
|
stateBeforeScan: number
|
||||||
|
): void | Promise<boolean> {
|
||||||
|
let handlerResult: void | boolean | Promise<boolean>;
|
||||||
|
|
||||||
|
for (let o = fromOp; o < scan.opCount; o++) {
|
||||||
|
scanCache.opIndex = o;
|
||||||
|
const kind = scan.kinds[o];
|
||||||
|
const start = scan.starts[o];
|
||||||
|
const len = scan.lengths[o];
|
||||||
|
const aux = scan.aux[o];
|
||||||
|
const chunkPos = kind === Op.Csi ? len : start;
|
||||||
|
|
||||||
|
switch (kind) {
|
||||||
|
case Op.Print:
|
||||||
|
host._printHandler(data, start, start + len);
|
||||||
|
break;
|
||||||
|
case Op.Execute: {
|
||||||
|
const code = aux;
|
||||||
|
const count = len > 0 ? len : 1;
|
||||||
|
for (let n = 0; n < count; n++) {
|
||||||
|
if (code < 0x18) {
|
||||||
|
const exe = host._executeHandlersArr[code];
|
||||||
|
if (exe) exe(code);
|
||||||
|
else host._executeHandlerFb(code);
|
||||||
|
} else if (host._executeHandlers[code]) {
|
||||||
|
host._executeHandlers[code]!();
|
||||||
|
} else {
|
||||||
|
host._executeHandlerFb(code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
host.precedingJoinState = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Op.Csi: {
|
||||||
|
host.collect = aux >> 8;
|
||||||
|
loadParams(host, scan, o);
|
||||||
|
const handlers = host._csiHandlers[aux];
|
||||||
|
let j = handlers ? handlers.length - 1 : -1;
|
||||||
|
for (; j >= 0; j--) {
|
||||||
|
handlerResult = handlers;
|
||||||
|
if (handlerResult === true) break;
|
||||||
|
if (handlerResult instanceof Promise) {
|
||||||
|
host._preserveStack(ParserStackType.CSI, handlers!, j, 0, chunkPos);
|
||||||
|
return handlerResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (j < 0) host._csiHandlerFb(aux, host._params);
|
||||||
|
host.precedingJoinState = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Op.Esc: {
|
||||||
|
host.collect = aux >> 8;
|
||||||
|
loadParams(host, scan, o);
|
||||||
|
const handlersEsc = host._escHandlers[aux];
|
||||||
|
const escCount = len > 0 ? len : 1;
|
||||||
|
escLoop: for (let rep = 0; rep < escCount; rep++) {
|
||||||
|
let jj = handlersEsc ? handlersEsc.length - 1 : -1;
|
||||||
|
for (; jj >= 0; jj--) {
|
||||||
|
handlerResult = handlersEsc![jj]();
|
||||||
|
if (handlerResult === true) continue escLoop;
|
||||||
|
if (handlerResult instanceof Promise) {
|
||||||
|
host._preserveStack(ParserStackType.ESC, handlersEsc!, jj, 0, chunkPos);
|
||||||
|
return handlerResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (jj < 0) host._escHandlerFb(aux);
|
||||||
|
}
|
||||||
|
host.precedingJoinState = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Op.OscStart:
|
||||||
|
host._oscParser.start();
|
||||||
|
break;
|
||||||
|
case Op.OscPut:
|
||||||
|
if (len > 0) host._oscParser.put(data, start, start + len);
|
||||||
|
break;
|
||||||
|
case Op.OscEnd: {
|
||||||
|
const term = aux;
|
||||||
|
handlerResult = host._oscParser.end(term !== 0x18 && term !== 0x1a);
|
||||||
|
if (handlerResult) {
|
||||||
|
host._preserveStack(ParserStackType.OSC, [], 0, 0, start);
|
||||||
|
return handlerResult;
|
||||||
|
}
|
||||||
|
if (term === 0x1b) host.currentState = ParserState.ESCAPE;
|
||||||
|
host._params.resetZdm();
|
||||||
|
host.collect = 0;
|
||||||
|
host.precedingJoinState = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Op.DcsHook: {
|
||||||
|
host.collect = aux >> 8;
|
||||||
|
loadParams(host, scan, o);
|
||||||
|
host._dcsParser.hook(aux, host._params);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Op.DcsPut:
|
||||||
|
if (len > 0) host._dcsParser.put(data, start, start + len);
|
||||||
|
break;
|
||||||
|
case Op.DcsUnhook: {
|
||||||
|
const term = aux;
|
||||||
|
handlerResult = host._dcsParser.unhook(term !== 0x18 && term !== 0x1a);
|
||||||
|
if (handlerResult) {
|
||||||
|
host._preserveStack(ParserStackType.DCS, [], 0, 0, start);
|
||||||
|
return handlerResult;
|
||||||
|
}
|
||||||
|
host._params.resetZdm();
|
||||||
|
host.collect = 0;
|
||||||
|
host.precedingJoinState = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Op.ApcStart:
|
||||||
|
host._apcParser.start(aux);
|
||||||
|
break;
|
||||||
|
case Op.ApcPut:
|
||||||
|
if (len > 0) host._apcParser.put(data, start, start + len);
|
||||||
|
break;
|
||||||
|
case Op.ApcEnd: {
|
||||||
|
const term = aux;
|
||||||
|
handlerResult = host._apcParser.end(term !== 0x18 && term !== 0x1a);
|
||||||
|
if (handlerResult) {
|
||||||
|
host._preserveStack(ParserStackType.APC, [], 0, 0, start);
|
||||||
|
return handlerResult;
|
||||||
|
}
|
||||||
|
host._params.resetZdm();
|
||||||
|
host.collect = 0;
|
||||||
|
host.precedingJoinState = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Op.Error: {
|
||||||
|
WasmEscapeScanner.exportParamsTo(host._params);
|
||||||
|
const inject = host._errorHandler({
|
||||||
|
position: start,
|
||||||
|
code: aux & 0xFFFF,
|
||||||
|
currentState: aux >> 16,
|
||||||
|
collect: WasmEscapeScanner.collect,
|
||||||
|
params: host._params,
|
||||||
|
abort: false
|
||||||
|
});
|
||||||
|
if (inject.abort) return;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
scanCache.opIndex = scan.opCount;
|
||||||
|
host.currentState = WasmEscapeScanner.currentState;
|
||||||
|
host.collect = WasmEscapeScanner.collect;
|
||||||
|
WasmEscapeScanner.exportParamsTo(host._params);
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 The xterm.js authors. All rights reserved.
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const Op = {
|
||||||
|
Print: 0,
|
||||||
|
Execute: 1,
|
||||||
|
Esc: 2,
|
||||||
|
Csi: 3,
|
||||||
|
Osc: 4,
|
||||||
|
Dcs: 5,
|
||||||
|
Apc: 6,
|
||||||
|
DcsHook: 7,
|
||||||
|
DcsPut: 8,
|
||||||
|
DcsUnhook: 9,
|
||||||
|
OscStart: 10,
|
||||||
|
OscPut: 11,
|
||||||
|
OscEnd: 12,
|
||||||
|
ApcStart: 13,
|
||||||
|
ApcPut: 14,
|
||||||
|
ApcEnd: 15,
|
||||||
|
Error: 16
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type OpKind = typeof Op[keyof typeof Op];
|
||||||
|
|
||||||
|
export type ScanResult = {
|
||||||
|
kinds: Uint8Array;
|
||||||
|
starts: Uint32Array;
|
||||||
|
lengths: Uint32Array;
|
||||||
|
aux: Uint32Array;
|
||||||
|
params: Uint32Array;
|
||||||
|
paramStarts: Uint32Array;
|
||||||
|
paramCounts: Uint16Array;
|
||||||
|
opCount: number;
|
||||||
|
nextOffset: number;
|
||||||
|
};
|
||||||
@@ -3,10 +3,12 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IDisposable, IParams, ParamsArray } from '../Types';
|
import { IDisposable } from '../Types';
|
||||||
import { ParserState } from './Constants';
|
import { ParserState } from './Constants';
|
||||||
|
|
||||||
export type { IParams, ParamsArray };
|
|
||||||
|
/** sequence params serialized to js arrays */
|
||||||
|
export type ParamsArray = (number | number[])[];
|
||||||
|
|
||||||
/** Params constructor type. */
|
/** Params constructor type. */
|
||||||
export interface IParamsConstructor {
|
export interface IParamsConstructor {
|
||||||
@@ -16,6 +18,28 @@ export interface IParamsConstructor {
|
|||||||
fromArray(values: ParamsArray): IParams;
|
fromArray(values: ParamsArray): IParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 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};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal state of EscapeSequenceParser.
|
* Internal state of EscapeSequenceParser.
|
||||||
* Used as argument of the error handler to allow
|
* Used as argument of the error handler to allow
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 The xterm.js authors. All rights reserved.
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { assert } from 'chai';
|
||||||
|
import { StringToUtf32 } from '../input/TextDecoder';
|
||||||
|
import { Op } from './ScanTypes';
|
||||||
|
import { WasmEscapeScanner } from './WasmEscapeScanner';
|
||||||
|
|
||||||
|
describe('WasmEscapeScanner', () => {
|
||||||
|
before(() => {
|
||||||
|
WasmEscapeScanner.initSync();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
WasmEscapeScanner.reset();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('scans hello with SGR sequences', () => {
|
||||||
|
const input = 'hello\x1b[31mred\x1b[0m';
|
||||||
|
const data = new Uint32Array(input.length);
|
||||||
|
const len = new StringToUtf32().decode(input, data);
|
||||||
|
const scan = WasmEscapeScanner.scan(data, len);
|
||||||
|
|
||||||
|
assert.equal(scan.opCount, 4);
|
||||||
|
assert.deepEqual(Array.from(scan.kinds), [Op.Print, Op.Csi, Op.Print, Op.Csi]);
|
||||||
|
assert.deepEqual(Array.from(scan.starts), [0, 0, 10, 1]);
|
||||||
|
// CSI/ESC: lengths hold final-byte index; print ops use run length
|
||||||
|
assert.deepEqual(Array.from(scan.lengths), [5, 9, 3, 16]);
|
||||||
|
assert.deepEqual(Array.from(scan.aux), [0, 'm'.charCodeAt(0), 0, 'm'.charCodeAt(0)]);
|
||||||
|
assert.deepEqual(Array.from(scan.paramStarts), [0, 0, 0, 1]);
|
||||||
|
assert.deepEqual(Array.from(scan.paramCounts), [0, 1, 0, 1]);
|
||||||
|
assert.deepEqual(Array.from(scan.params), [31, 0]);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,208 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 The xterm.js authors. All rights reserved.
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Params } from './Params';
|
||||||
|
import { Op, ScanResult } from './ScanTypes';
|
||||||
|
import { PARSER_WASM_BASE64 } from './wasm/parser.wasm.embed';
|
||||||
|
|
||||||
|
export { Op };
|
||||||
|
|
||||||
|
const WASM_IMPORTS = {
|
||||||
|
env: {
|
||||||
|
memory: new WebAssembly.Memory({ initial: 1024, maximum: 1024 })
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let wasmModule: WebAssembly.Instance | undefined;
|
||||||
|
let wasmExports: {
|
||||||
|
memory: WebAssembly.Memory;
|
||||||
|
reset: () => void;
|
||||||
|
scan: (offset: number, length: number) => number;
|
||||||
|
set_state: (state: number, collect: number) => void;
|
||||||
|
get_input_ptr: () => number;
|
||||||
|
get_kinds_ptr: () => number;
|
||||||
|
get_starts_ptr: () => number;
|
||||||
|
get_lengths_ptr: () => number;
|
||||||
|
get_aux_ptr: () => number;
|
||||||
|
get_param_starts_ptr: () => number;
|
||||||
|
get_param_counts_ptr: () => number;
|
||||||
|
get_params_ptr: () => number;
|
||||||
|
get_state_ptr: () => number;
|
||||||
|
get_header_ptr: () => number;
|
||||||
|
sync_params_from: (srcPtr: number, len: number) => void;
|
||||||
|
export_params_to: (dstPtr: number, maxLen: number) => void;
|
||||||
|
get_params_len: () => number;
|
||||||
|
get_subparams_len: () => number;
|
||||||
|
get_subparams_ptr: () => number;
|
||||||
|
get_subparams_idx_ptr: () => number;
|
||||||
|
};
|
||||||
|
|
||||||
|
async function initWasm(): Promise<void> {
|
||||||
|
if (wasmModule) return;
|
||||||
|
const bytes = Uint8Array.from(atob(PARSER_WASM_BASE64), c => c.charCodeAt(0));
|
||||||
|
const mod = await WebAssembly.instantiate(bytes, WASM_IMPORTS);
|
||||||
|
wasmModule = mod.instance;
|
||||||
|
wasmExports = wasmModule.exports as typeof wasmExports;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ensureWasm(): typeof wasmExports {
|
||||||
|
if (!wasmExports) {
|
||||||
|
throw new Error('WasmEscapeScanner not initialized. Call WasmEscapeScanner.init() first.');
|
||||||
|
}
|
||||||
|
return wasmExports;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class WasmEscapeScanner {
|
||||||
|
private static _initPromise: Promise<void> | undefined;
|
||||||
|
private static _syncReady = false;
|
||||||
|
|
||||||
|
public static init(): Promise<void> {
|
||||||
|
if (!this._initPromise) {
|
||||||
|
this._initPromise = initWasm().then(() => {
|
||||||
|
this._syncReady = true;
|
||||||
|
wasmExports.reset();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return this._initPromise;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Synchronous init for unit tests (Node supports sync instantiate). */
|
||||||
|
public static initSync(): void {
|
||||||
|
if (this._syncReady) return;
|
||||||
|
const binary = globalThis.atob(PARSER_WASM_BASE64);
|
||||||
|
const bytes = new Uint8Array(binary.length);
|
||||||
|
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
||||||
|
const mod = new WebAssembly.Module(bytes);
|
||||||
|
wasmModule = new WebAssembly.Instance(mod, WASM_IMPORTS);
|
||||||
|
wasmExports = wasmModule.exports as typeof wasmExports;
|
||||||
|
wasmExports.reset();
|
||||||
|
this._syncReady = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static reset(): void {
|
||||||
|
ensureWasm().reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static get currentState(): number {
|
||||||
|
const mem = new Uint32Array(ensureWasm().memory.buffer);
|
||||||
|
const statePtr = ensureWasm().get_state_ptr() >> 2;
|
||||||
|
return mem[statePtr];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static set currentState(value: number) {
|
||||||
|
const ex = ensureWasm();
|
||||||
|
const mem = new Uint32Array(ex.memory.buffer);
|
||||||
|
const statePtr = ex.get_state_ptr() >> 2;
|
||||||
|
ex.set_state(value, mem[statePtr + 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static get collect(): number {
|
||||||
|
const mem = new Uint32Array(ensureWasm().memory.buffer);
|
||||||
|
return mem[(ensureWasm().get_state_ptr() >> 2) + 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static set collect(value: number) {
|
||||||
|
const ex = ensureWasm();
|
||||||
|
ex.set_state(memState(ex), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static syncParserState(currentState: number, collect: number, params: Params): void {
|
||||||
|
const ex = ensureWasm();
|
||||||
|
ex.set_state(currentState, collect);
|
||||||
|
if (params.length === 0) {
|
||||||
|
ex.sync_params_from(ex.get_params_ptr(), 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const mem = ex.memory.buffer;
|
||||||
|
const paramsPtr = ex.get_params_ptr();
|
||||||
|
const view = new Int32Array(mem, paramsPtr, params.length);
|
||||||
|
for (let i = 0; i < params.length; i++) {
|
||||||
|
view[i] = params.params[i];
|
||||||
|
}
|
||||||
|
ex.sync_params_from(paramsPtr, params.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static exportParamsTo(params: Params): void {
|
||||||
|
const ex = ensureWasm();
|
||||||
|
const len = ex.get_params_len();
|
||||||
|
params.reset();
|
||||||
|
if (len === 0) {
|
||||||
|
params.resetZdm();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const mem = ex.memory.buffer;
|
||||||
|
const dstPtr = ex.get_params_ptr();
|
||||||
|
ex.export_params_to(dstPtr, len);
|
||||||
|
const pView = new Int32Array(mem, dstPtr, len);
|
||||||
|
const subLen = ex.get_subparams_len();
|
||||||
|
const subView = subLen > 0 ? new Int32Array(mem, ex.get_subparams_ptr(), subLen) : undefined;
|
||||||
|
const idxView = new Uint16Array(mem, ex.get_subparams_idx_ptr(), len);
|
||||||
|
|
||||||
|
params.resetZdm();
|
||||||
|
params.params[0] = pView[0];
|
||||||
|
params.length = 1;
|
||||||
|
if (subView && len > 0) {
|
||||||
|
const start0 = idxView[0] >> 8;
|
||||||
|
const end0 = idxView[0] & 0xFF;
|
||||||
|
for (let k = start0; k < end0; k++) {
|
||||||
|
params.addSubParam(subView[k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let i = 1; i < len; i++) {
|
||||||
|
params.addParam(pView[i]);
|
||||||
|
if (subView) {
|
||||||
|
const start = idxView[i] >> 8;
|
||||||
|
const end = idxView[i] & 0xFF;
|
||||||
|
for (let k = start; k < end; k++) {
|
||||||
|
params.addSubParam(subView[k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static scan(data: Uint32Array, length: number, offset = 0): ScanResult {
|
||||||
|
const ex = ensureWasm();
|
||||||
|
const inputPtr = ex.get_input_ptr();
|
||||||
|
const mem = ex.memory.buffer;
|
||||||
|
const inputView = new Uint32Array(mem, inputPtr, length);
|
||||||
|
inputView.set(data.subarray(0, length));
|
||||||
|
|
||||||
|
const opCount = ex.scan(offset, length);
|
||||||
|
if (opCount < 0) {
|
||||||
|
throw new Error('Wasm parser op buffer overflow');
|
||||||
|
}
|
||||||
|
|
||||||
|
const count = opCount;
|
||||||
|
const kinds = new Uint8Array(mem, ex.get_kinds_ptr(), count);
|
||||||
|
const starts = new Uint32Array(mem, ex.get_starts_ptr(), count);
|
||||||
|
const lengths = new Uint32Array(mem, ex.get_lengths_ptr(), count);
|
||||||
|
const aux = new Uint32Array(mem, ex.get_aux_ptr(), count);
|
||||||
|
const paramStarts = new Uint32Array(mem, ex.get_param_starts_ptr(), count);
|
||||||
|
const paramCounts = new Uint16Array(mem, ex.get_param_counts_ptr(), count);
|
||||||
|
|
||||||
|
const headerView = new Uint32Array(mem, ex.get_header_ptr(), 4);
|
||||||
|
const paramsLen = headerView[2];
|
||||||
|
const nextOffset = headerView[3];
|
||||||
|
|
||||||
|
const params = new Uint32Array(mem, ex.get_params_ptr(), paramsLen);
|
||||||
|
|
||||||
|
return {
|
||||||
|
kinds: kinds.slice(),
|
||||||
|
starts: starts.slice(),
|
||||||
|
lengths: lengths.slice(),
|
||||||
|
aux: aux.slice(),
|
||||||
|
params: params.slice(),
|
||||||
|
paramStarts: paramStarts.slice(),
|
||||||
|
paramCounts: paramCounts.slice(),
|
||||||
|
opCount: count,
|
||||||
|
nextOffset
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function memState(ex: typeof wasmExports): number {
|
||||||
|
const mem = new Uint32Array(ex.memory.buffer);
|
||||||
|
return mem[ex.get_state_ptr() >> 2];
|
||||||
|
}
|
||||||
@@ -0,0 +1,505 @@
|
|||||||
|
/* Copyright (c) 2026 The xterm.js authors. All rights reserved.
|
||||||
|
* @license MIT */
|
||||||
|
|
||||||
|
#include "parser.h"
|
||||||
|
#include "transition_table.h"
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
/* Static transition table is linked at 65536; scratch must sit above it. */
|
||||||
|
#define MEM_BASE 65536
|
||||||
|
#define PARSER_TABLE_BYTE_SIZE (PARSER_TABLE_SIZE * sizeof(uint16_t))
|
||||||
|
#define MEM_STATE (((MEM_BASE + PARSER_TABLE_BYTE_SIZE) + 255u) & ~255u)
|
||||||
|
/* ParserWasmState is ~2.3KB; keep header and op buffers past it */
|
||||||
|
#define MEM_HEADER (MEM_STATE + 2048)
|
||||||
|
#define MEM_KINDS (MEM_HEADER + 64)
|
||||||
|
#define MEM_STARTS (MEM_KINDS + PARSER_MAX_OPS)
|
||||||
|
#define MEM_LENGTHS (MEM_STARTS + PARSER_MAX_OPS * 4)
|
||||||
|
#define MEM_AUX (MEM_LENGTHS + PARSER_MAX_OPS * 4)
|
||||||
|
#define MEM_PARAM_STARTS (MEM_AUX + PARSER_MAX_OPS * 4)
|
||||||
|
#define MEM_PARAM_COUNTS (MEM_PARAM_STARTS + PARSER_MAX_OPS * 4)
|
||||||
|
#define MEM_PARAMS_ARENA (MEM_PARAM_COUNTS + PARSER_MAX_OPS * 2) /* uint16 param counts */
|
||||||
|
#define MEM_INPUT_BASE (MEM_PARAMS_ARENA + PARSER_MAX_PARAMS * 4)
|
||||||
|
|
||||||
|
static ParserWasmState *state(void) { return (ParserWasmState *)(uintptr_t)MEM_STATE; }
|
||||||
|
static ParserScanHeader *header(void) { return (ParserScanHeader *)(uintptr_t)MEM_HEADER; }
|
||||||
|
static uint8_t *kinds(void) { return (uint8_t *)(uintptr_t)MEM_KINDS; }
|
||||||
|
static uint32_t *starts(void) { return (uint32_t *)(uintptr_t)MEM_STARTS; }
|
||||||
|
static uint32_t *lengths(void) { return (uint32_t *)(uintptr_t)MEM_LENGTHS; }
|
||||||
|
static uint32_t *aux(void) { return (uint32_t *)(uintptr_t)MEM_AUX; }
|
||||||
|
static uint32_t *param_starts(void) { return (uint32_t *)(uintptr_t)MEM_PARAM_STARTS; }
|
||||||
|
static uint16_t *param_counts(void) { return (uint16_t *)(uintptr_t)MEM_PARAM_COUNTS; }
|
||||||
|
static int32_t *params_arena(void) { return (int32_t *)(uintptr_t)MEM_PARAMS_ARENA; }
|
||||||
|
static uint32_t *input(void) { return (uint32_t *)(uintptr_t)MEM_INPUT_BASE; }
|
||||||
|
|
||||||
|
static uint32_t transition_lookup(uint32_t st, uint32_t code) {
|
||||||
|
uint32_t idx = code < PARSER_NON_ASCII_PRINTABLE ? code : PARSER_NON_ASCII_PRINTABLE;
|
||||||
|
return PARSER_TRANSITION_TABLE[st << PARSER_TABLE_INDEX_STATE_SHIFT | idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
static void params_reset_zdm(ParserWasmState *s) {
|
||||||
|
s->params_len = 1;
|
||||||
|
s->subparams_len = 0;
|
||||||
|
s->reject_digits = 0;
|
||||||
|
s->reject_sub_digits = 0;
|
||||||
|
s->digit_is_sub = 0;
|
||||||
|
s->subparams_idx[0] = 0;
|
||||||
|
s->params[0] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void params_reset(ParserWasmState *s) {
|
||||||
|
s->params_len = 0;
|
||||||
|
s->subparams_len = 0;
|
||||||
|
s->reject_digits = 0;
|
||||||
|
s->reject_sub_digits = 0;
|
||||||
|
s->digit_is_sub = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void params_add_param(ParserWasmState *s, int32_t value) {
|
||||||
|
s->digit_is_sub = 0;
|
||||||
|
if (s->params_len >= PARSER_PARAMS_MAX_LEN) {
|
||||||
|
s->reject_digits = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
s->subparams_idx[s->params_len] = (uint16_t)(s->subparams_len << 8 | s->subparams_len);
|
||||||
|
if (value < 0) value = 0;
|
||||||
|
if (value > 0x7FFFFFFF) value = 0x7FFFFFFF;
|
||||||
|
s->params[s->params_len++] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void params_add_subparam(ParserWasmState *s, int32_t value) {
|
||||||
|
s->digit_is_sub = 1;
|
||||||
|
if (!s->params_len) return;
|
||||||
|
if (s->reject_digits || s->subparams_len >= PARSER_SUBPARAMS_MAX_LEN) {
|
||||||
|
s->reject_sub_digits = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (value < 0) value = -1;
|
||||||
|
if (value > 0x7FFFFFFF) value = 0x7FFFFFFF;
|
||||||
|
s->subparams[s->subparams_len++] = value;
|
||||||
|
s->subparams_idx[s->params_len - 1]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void params_add_digit(ParserWasmState *s, int32_t digit) {
|
||||||
|
uint32_t len;
|
||||||
|
if (s->reject_digits) return;
|
||||||
|
len = s->digit_is_sub ? s->subparams_len : s->params_len;
|
||||||
|
if (!len) return;
|
||||||
|
if (s->digit_is_sub && s->reject_sub_digits) return;
|
||||||
|
int32_t *store = s->digit_is_sub ? s->subparams : s->params;
|
||||||
|
int32_t cur = store[len - 1];
|
||||||
|
store[len - 1] = cur >= 0 ? (cur * 10 + digit > 0x7FFFFFFF ? 0x7FFFFFFF : cur * 10 + digit) : digit;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void copy_params_to_arena(uint32_t op_idx, ParserWasmState *s) {
|
||||||
|
uint32_t start = header()->params_arena_len;
|
||||||
|
param_starts()[op_idx] = start;
|
||||||
|
param_counts()[op_idx] = (uint16_t)s->params_len;
|
||||||
|
for (uint32_t i = 0; i < s->params_len; i++) {
|
||||||
|
if (header()->params_arena_len >= PARSER_MAX_PARAMS) return;
|
||||||
|
params_arena()[header()->params_arena_len++] = s->params[i];
|
||||||
|
uint16_t idx = s->subparams_idx[i];
|
||||||
|
uint32_t sub_start = idx >> 8;
|
||||||
|
uint32_t sub_end = idx & 0xFF;
|
||||||
|
for (uint32_t k = sub_start; k < sub_end; k++) {
|
||||||
|
if (header()->params_arena_len >= PARSER_MAX_PARAMS) return;
|
||||||
|
int32_t sv = s->subparams[k];
|
||||||
|
uint32_t encoded = 0x80000000u | (uint32_t)(sv < 0 ? 0x7FFFFFFF : sv);
|
||||||
|
params_arena()[header()->params_arena_len++] = encoded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int emit_op(uint8_t kind, uint32_t start, uint32_t length, uint32_t aux_val, ParserWasmState *s) {
|
||||||
|
uint32_t idx = header()->op_count;
|
||||||
|
if (idx > 0) {
|
||||||
|
uint32_t prev = idx - 1;
|
||||||
|
if (kind == OP_EXECUTE && kinds()[prev] == OP_EXECUTE && aux()[prev] == aux_val) {
|
||||||
|
lengths()[prev]++;
|
||||||
|
return (int)prev;
|
||||||
|
}
|
||||||
|
if (kind == OP_ESC && kinds()[prev] == OP_ESC && aux()[prev] == aux_val) {
|
||||||
|
lengths()[prev]++;
|
||||||
|
return (int)prev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (idx >= PARSER_MAX_OPS) return -1;
|
||||||
|
kinds()[idx] = kind;
|
||||||
|
starts()[idx] = start;
|
||||||
|
if ((kind == OP_EXECUTE || kind == OP_ESC) && length == 0) {
|
||||||
|
lengths()[idx] = 1;
|
||||||
|
} else {
|
||||||
|
lengths()[idx] = length;
|
||||||
|
}
|
||||||
|
aux()[idx] = aux_val;
|
||||||
|
if (kind == OP_CSI || kind == OP_DCS_HOOK) {
|
||||||
|
uint32_t input_pos = start;
|
||||||
|
copy_params_to_arena(idx, s);
|
||||||
|
lengths()[idx] = input_pos;
|
||||||
|
starts()[idx] = param_starts()[idx];
|
||||||
|
} else if (kind == OP_ESC) {
|
||||||
|
uint32_t input_pos = start;
|
||||||
|
uint32_t repeat = lengths()[idx];
|
||||||
|
copy_params_to_arena(idx, s);
|
||||||
|
starts()[idx] = input_pos;
|
||||||
|
lengths()[idx] = repeat;
|
||||||
|
} else {
|
||||||
|
param_starts()[idx] = 0;
|
||||||
|
param_counts()[idx] = 0;
|
||||||
|
}
|
||||||
|
header()->op_count++;
|
||||||
|
return (int)idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int is_printable(uint32_t code) {
|
||||||
|
return (code >= 0x20 && code <= 0x7e) || code >= PARSER_NON_ASCII_PRINTABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((export_name("reset")))
|
||||||
|
void reset(void) {
|
||||||
|
ParserWasmState *s = state();
|
||||||
|
s->current_state = PARSER_STATE_GROUND;
|
||||||
|
s->collect = 0;
|
||||||
|
s->preceding_join_state = 0;
|
||||||
|
s->osc_start = 0;
|
||||||
|
s->dcs_start = 0;
|
||||||
|
s->apc_start = 0;
|
||||||
|
params_reset_zdm(s);
|
||||||
|
header()->op_count = 0;
|
||||||
|
header()->input_len = 0;
|
||||||
|
header()->params_arena_len = 0;
|
||||||
|
header()->scan_offset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((export_name("get_input_ptr")))
|
||||||
|
uint32_t get_input_ptr(void) { return MEM_INPUT_BASE; }
|
||||||
|
|
||||||
|
__attribute__((export_name("get_kinds_ptr")))
|
||||||
|
uint32_t get_kinds_ptr(void) { return MEM_KINDS; }
|
||||||
|
|
||||||
|
__attribute__((export_name("get_starts_ptr")))
|
||||||
|
uint32_t get_starts_ptr(void) { return MEM_STARTS; }
|
||||||
|
|
||||||
|
__attribute__((export_name("get_lengths_ptr")))
|
||||||
|
uint32_t get_lengths_ptr(void) { return MEM_LENGTHS; }
|
||||||
|
|
||||||
|
__attribute__((export_name("get_aux_ptr")))
|
||||||
|
uint32_t get_aux_ptr(void) { return MEM_AUX; }
|
||||||
|
|
||||||
|
__attribute__((export_name("get_param_starts_ptr")))
|
||||||
|
uint32_t get_param_starts_ptr(void) { return MEM_PARAM_STARTS; }
|
||||||
|
|
||||||
|
__attribute__((export_name("get_param_counts_ptr")))
|
||||||
|
uint32_t get_param_counts_ptr(void) { return MEM_PARAM_COUNTS; }
|
||||||
|
|
||||||
|
__attribute__((export_name("get_params_ptr")))
|
||||||
|
uint32_t get_params_ptr(void) { return MEM_PARAMS_ARENA; }
|
||||||
|
|
||||||
|
__attribute__((export_name("get_state_ptr")))
|
||||||
|
uint32_t get_state_ptr(void) { return MEM_STATE; }
|
||||||
|
|
||||||
|
__attribute__((export_name("get_header_ptr")))
|
||||||
|
uint32_t get_header_ptr(void) { return MEM_HEADER; }
|
||||||
|
|
||||||
|
__attribute__((export_name("set_state")))
|
||||||
|
void set_state(uint32_t current_state, uint32_t collect) {
|
||||||
|
state()->current_state = current_state;
|
||||||
|
state()->collect = collect;
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((export_name("export_params_to")))
|
||||||
|
void export_params_to(uint32_t dst_ptr, uint32_t max_len) {
|
||||||
|
ParserWasmState *s = state();
|
||||||
|
int32_t *dst = (int32_t *)(uintptr_t)dst_ptr;
|
||||||
|
uint32_t n = s->params_len < max_len ? s->params_len : max_len;
|
||||||
|
for (uint32_t i = 0; i < n; i++) {
|
||||||
|
dst[i] = s->params[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((export_name("get_params_len")))
|
||||||
|
uint32_t get_params_len(void) {
|
||||||
|
return state()->params_len;
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((export_name("get_subparams_len")))
|
||||||
|
uint32_t get_subparams_len(void) {
|
||||||
|
return state()->subparams_len;
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((export_name("get_subparams_ptr")))
|
||||||
|
uint32_t get_subparams_ptr(void) {
|
||||||
|
return (uint32_t)(uintptr_t)state()->subparams;
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((export_name("get_subparams_idx_ptr")))
|
||||||
|
uint32_t get_subparams_idx_ptr(void) {
|
||||||
|
return (uint32_t)(uintptr_t)state()->subparams_idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((export_name("sync_params_from")))
|
||||||
|
void sync_params_from(uint32_t src_ptr, uint32_t len) {
|
||||||
|
ParserWasmState *s = state();
|
||||||
|
const int32_t *src = (const int32_t *)(uintptr_t)src_ptr;
|
||||||
|
s->params_len = len > PARSER_PARAMS_MAX_LEN ? PARSER_PARAMS_MAX_LEN : len;
|
||||||
|
for (uint32_t i = 0; i < s->params_len; i++) {
|
||||||
|
s->params[i] = src[i];
|
||||||
|
}
|
||||||
|
s->subparams_len = 0;
|
||||||
|
s->reject_digits = 0;
|
||||||
|
s->reject_sub_digits = 0;
|
||||||
|
s->digit_is_sub = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((export_name("probe_action")))
|
||||||
|
uint32_t probe_action(uint32_t state_id, uint32_t code) {
|
||||||
|
uint32_t tr = transition_lookup(state_id, code);
|
||||||
|
return tr >> PARSER_TABLE_ACTION_SHIFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int emit_or_stop(uint8_t kind, uint32_t start, uint32_t length, uint32_t aux_val, ParserWasmState *s, uint32_t stop_at) {
|
||||||
|
if (emit_op(kind, start, length, aux_val, s) < 0) {
|
||||||
|
header()->scan_offset = stop_at;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((export_name("scan")))
|
||||||
|
int32_t scan(uint32_t offset, uint32_t length) {
|
||||||
|
ParserWasmState *s = state();
|
||||||
|
ParserScanHeader *h = header();
|
||||||
|
h->op_count = 0;
|
||||||
|
h->params_arena_len = 0;
|
||||||
|
h->input_len = length;
|
||||||
|
uint32_t i = offset;
|
||||||
|
uint32_t code;
|
||||||
|
uint32_t transition;
|
||||||
|
uint32_t action;
|
||||||
|
uint32_t print_start;
|
||||||
|
|
||||||
|
while (i < length) {
|
||||||
|
code = input()[i];
|
||||||
|
|
||||||
|
if (code < 0x18 && s->current_state <= PARSER_STATE_CSI_PARAM + 2) {
|
||||||
|
if (!emit_or_stop(OP_EXECUTE, i, 0, code, s, i)) {
|
||||||
|
return h->op_count > 0 ? (int32_t)h->op_count : -1;
|
||||||
|
}
|
||||||
|
s->preceding_join_state = 0;
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code == 0x1b && s->current_state < PARSER_STATE_OSC_STRING && i + 2 < length && input()[i + 1] == 0x5b) {
|
||||||
|
params_reset_zdm(s);
|
||||||
|
s->collect = 0;
|
||||||
|
uint32_t k = i + 2;
|
||||||
|
uint32_t ch = input()[k];
|
||||||
|
if (ch >= 0x3c && ch <= 0x3f) {
|
||||||
|
s->collect = ch;
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
int csi_done = 0;
|
||||||
|
for (; k < length; k++) {
|
||||||
|
ch = input()[k];
|
||||||
|
if (ch >= 0x30 && ch <= 0x39) {
|
||||||
|
params_add_digit(s, ch - 48);
|
||||||
|
} else if (ch == 0x3b) {
|
||||||
|
params_add_param(s, 0);
|
||||||
|
} else if (ch == 0x3a) {
|
||||||
|
params_add_subparam(s, -1);
|
||||||
|
} else if (ch >= 0x40 && ch <= 0x7e) {
|
||||||
|
uint32_t ident = (s->collect << 8) | ch;
|
||||||
|
if (!emit_or_stop(OP_CSI, k, 0, ident, s, k)) {
|
||||||
|
return h->op_count > 0 ? (int32_t)h->op_count : -1;
|
||||||
|
}
|
||||||
|
s->preceding_join_state = 0;
|
||||||
|
i = k;
|
||||||
|
s->current_state = PARSER_STATE_GROUND;
|
||||||
|
csi_done = 1;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!csi_done) {
|
||||||
|
i = k - 1;
|
||||||
|
s->current_state = PARSER_STATE_CSI_PARAM;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
transition = transition_lookup(s->current_state, code);
|
||||||
|
action = transition >> PARSER_TABLE_ACTION_SHIFT;
|
||||||
|
{
|
||||||
|
uint32_t next_state = transition & PARSER_TABLE_STATE_MASK;
|
||||||
|
switch (action) {
|
||||||
|
case 1: /* ERROR - report state before transition (matches TS parser) */
|
||||||
|
if (!emit_or_stop(OP_ERROR, i, 0, (s->current_state << 16) | code, s, i)) {
|
||||||
|
return h->op_count > 0 ? (int32_t)h->op_count : -1;
|
||||||
|
}
|
||||||
|
s->current_state = next_state;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
s->current_state = next_state;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (action) {
|
||||||
|
case PARSER_ACTION_PRINT: {
|
||||||
|
print_start = i;
|
||||||
|
uint32_t c = i;
|
||||||
|
uint32_t l4 = length > 4 ? length - 4 : 0;
|
||||||
|
while (c < l4 && is_printable(input()[c]) && is_printable(input()[c + 1]) &&
|
||||||
|
is_printable(input()[c + 2]) && is_printable(input()[c + 3])) {
|
||||||
|
c += 4;
|
||||||
|
}
|
||||||
|
while (c < length && is_printable(input()[c])) c++;
|
||||||
|
if (!emit_or_stop(OP_PRINT, print_start, c - print_start, 0, s, i)) {
|
||||||
|
return h->op_count > 0 ? (int32_t)h->op_count : -1;
|
||||||
|
}
|
||||||
|
i = c - 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PARSER_ACTION_EXECUTE:
|
||||||
|
if (!emit_or_stop(OP_EXECUTE, i, 0, code, s, i)) {
|
||||||
|
return h->op_count > 0 ? (int32_t)h->op_count : -1;
|
||||||
|
}
|
||||||
|
s->preceding_join_state = 0;
|
||||||
|
break;
|
||||||
|
case PARSER_ACTION_IGNORE:
|
||||||
|
break;
|
||||||
|
case 1: /* ERROR - handled above */
|
||||||
|
break;
|
||||||
|
case PARSER_ACTION_CSI_DISPATCH: {
|
||||||
|
uint32_t ident = (s->collect << 8) | code;
|
||||||
|
if (!emit_or_stop(OP_CSI, i, 0, ident, s, i)) {
|
||||||
|
return h->op_count > 0 ? (int32_t)h->op_count : -1;
|
||||||
|
}
|
||||||
|
s->preceding_join_state = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 8: /* PARAM */
|
||||||
|
do {
|
||||||
|
switch (code) {
|
||||||
|
case 0x3b: params_add_param(s, 0); break;
|
||||||
|
case 0x3a: params_add_subparam(s, -1); break;
|
||||||
|
default: params_add_digit(s, code - 48); break;
|
||||||
|
}
|
||||||
|
} while (++i < length && (code = input()[i]) > 0x2f && code < 0x3c);
|
||||||
|
i--;
|
||||||
|
break;
|
||||||
|
case 9: /* COLLECT */
|
||||||
|
s->collect <<= 8;
|
||||||
|
s->collect |= code;
|
||||||
|
break;
|
||||||
|
case PARSER_ACTION_ESC_DISPATCH: {
|
||||||
|
uint32_t ident = (s->collect << 8) | code;
|
||||||
|
if (!emit_or_stop(OP_ESC, i, 0, ident, s, i)) {
|
||||||
|
return h->op_count > 0 ? (int32_t)h->op_count : -1;
|
||||||
|
}
|
||||||
|
s->preceding_join_state = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 11: /* CLEAR */
|
||||||
|
params_reset_zdm(s);
|
||||||
|
s->collect = 0;
|
||||||
|
break;
|
||||||
|
case 4: /* OSC_START */
|
||||||
|
if (!emit_or_stop(OP_OSC_START, i, 0, 0, s, i)) {
|
||||||
|
return h->op_count > 0 ? (int32_t)h->op_count : -1;
|
||||||
|
}
|
||||||
|
s->osc_start = i + 1;
|
||||||
|
break;
|
||||||
|
case 5: /* OSC_PUT */
|
||||||
|
for (uint32_t j = i + 1; ; j++) {
|
||||||
|
if (j >= length || (code = input()[j]) < 0x20 ||
|
||||||
|
(code > 0x7f && code < PARSER_NON_ASCII_PRINTABLE)) {
|
||||||
|
if (j > i && !emit_or_stop(OP_OSC_PUT, i, j - i, 0, s, i)) {
|
||||||
|
return h->op_count > 0 ? (int32_t)h->op_count : -1;
|
||||||
|
}
|
||||||
|
i = j - 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PARSER_ACTION_OSC_END: {
|
||||||
|
if (!emit_or_stop(OP_OSC_END, i, 0, code, s, i)) {
|
||||||
|
return h->op_count > 0 ? (int32_t)h->op_count : -1;
|
||||||
|
}
|
||||||
|
s->osc_term = code;
|
||||||
|
if (code == 0x1b) s->current_state = PARSER_STATE_ESCAPE;
|
||||||
|
params_reset_zdm(s);
|
||||||
|
s->collect = 0;
|
||||||
|
s->preceding_join_state = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 12: /* DCS_HOOK */
|
||||||
|
s->dcs_hook_ident = (s->collect << 8) | code;
|
||||||
|
if (!emit_or_stop(OP_DCS_HOOK, i, 0, s->dcs_hook_ident, s, i)) {
|
||||||
|
return h->op_count > 0 ? (int32_t)h->op_count : -1;
|
||||||
|
}
|
||||||
|
s->dcs_start = i + 1;
|
||||||
|
break;
|
||||||
|
case 13: /* DCS_PUT */
|
||||||
|
for (uint32_t j = i + 1; ; j++) {
|
||||||
|
if (j >= length || (code = input()[j]) == 0x18 || code == 0x1a || code == 0x1b ||
|
||||||
|
(code > 0x7f && code < PARSER_NON_ASCII_PRINTABLE)) {
|
||||||
|
if (j > i && !emit_or_stop(OP_DCS_PUT, i, j - i, 0, s, i)) {
|
||||||
|
return h->op_count > 0 ? (int32_t)h->op_count : -1;
|
||||||
|
}
|
||||||
|
i = j - 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PARSER_ACTION_DCS_UNHOOK: {
|
||||||
|
if (!emit_or_stop(OP_DCS_UNHOOK, i, 0, code, s, i)) {
|
||||||
|
return h->op_count > 0 ? (int32_t)h->op_count : -1;
|
||||||
|
}
|
||||||
|
if (code == 0x1b) s->current_state = PARSER_STATE_ESCAPE;
|
||||||
|
params_reset_zdm(s);
|
||||||
|
s->collect = 0;
|
||||||
|
s->preceding_join_state = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 15: /* APC_START */
|
||||||
|
s->apc_hook_ident = (s->collect << 8) | code;
|
||||||
|
if (!emit_or_stop(OP_APC_START, i, 0, s->apc_hook_ident, s, i)) {
|
||||||
|
return h->op_count > 0 ? (int32_t)h->op_count : -1;
|
||||||
|
}
|
||||||
|
s->apc_start = i + 1;
|
||||||
|
break;
|
||||||
|
case 16: /* APC_PUT */
|
||||||
|
for (uint32_t j = i + 1; ; j++) {
|
||||||
|
if (j < length && (
|
||||||
|
(input()[j] >= 0x20 && input()[j] < 0x7f) ||
|
||||||
|
(input()[j] >= 0x08 && input()[j] < 0x0e) ||
|
||||||
|
input()[j] >= PARSER_NON_ASCII_PRINTABLE
|
||||||
|
)) continue;
|
||||||
|
if (j > i && !emit_or_stop(OP_APC_PUT, i, j - i, 0, s, i)) {
|
||||||
|
return h->op_count > 0 ? (int32_t)h->op_count : -1;
|
||||||
|
}
|
||||||
|
i = j - 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PARSER_ACTION_APC_END: {
|
||||||
|
if (!emit_or_stop(OP_APC_END, i, 0, code, s, i)) {
|
||||||
|
return h->op_count > 0 ? (int32_t)h->op_count : -1;
|
||||||
|
}
|
||||||
|
if (code == 0x1b) s->current_state = PARSER_STATE_ESCAPE;
|
||||||
|
params_reset_zdm(s);
|
||||||
|
s->collect = 0;
|
||||||
|
s->preceding_join_state = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
h->scan_offset = length;
|
||||||
|
return (int32_t)h->op_count;
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
/* Copyright (c) 2026 The xterm.js authors. All rights reserved.
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
#ifndef PARSER_WASM_H
|
||||||
|
#define PARSER_WASM_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define PARSER_NON_ASCII_PRINTABLE 0xA0
|
||||||
|
#define PARSER_TABLE_ACTION_SHIFT 8
|
||||||
|
#define PARSER_TABLE_STATE_MASK 255
|
||||||
|
#define PARSER_TABLE_INDEX_STATE_SHIFT 8
|
||||||
|
|
||||||
|
#define OP_PRINT 0
|
||||||
|
#define OP_EXECUTE 1
|
||||||
|
#define OP_ESC 2
|
||||||
|
#define OP_CSI 3
|
||||||
|
#define OP_OSC 4
|
||||||
|
#define OP_DCS 5
|
||||||
|
#define OP_APC 6
|
||||||
|
#define OP_DCS_HOOK 7
|
||||||
|
#define OP_DCS_PUT 8
|
||||||
|
#define OP_DCS_UNHOOK 9
|
||||||
|
#define OP_OSC_START 10
|
||||||
|
#define OP_OSC_PUT 11
|
||||||
|
#define OP_OSC_END 12
|
||||||
|
#define OP_APC_START 13
|
||||||
|
#define OP_APC_PUT 14
|
||||||
|
#define OP_APC_END 15
|
||||||
|
#define OP_ERROR 16
|
||||||
|
|
||||||
|
#define PARSER_STATE_GROUND 0
|
||||||
|
#define PARSER_STATE_ESCAPE 1
|
||||||
|
#define PARSER_STATE_OSC_STRING 8
|
||||||
|
#define PARSER_STATE_DCS_PASSTHROUGH 13
|
||||||
|
#define PARSER_STATE_APC_PASSTHROUGH 16
|
||||||
|
#define PARSER_STATE_CSI_PARAM 4
|
||||||
|
|
||||||
|
#define PARSER_ACTION_IGNORE 0
|
||||||
|
#define PARSER_ACTION_PRINT 2
|
||||||
|
#define PARSER_ACTION_EXECUTE 3
|
||||||
|
#define PARSER_ACTION_CSI_DISPATCH 7
|
||||||
|
#define PARSER_ACTION_ESC_DISPATCH 10
|
||||||
|
#define PARSER_ACTION_OSC_END 6
|
||||||
|
#define PARSER_ACTION_DCS_UNHOOK 14
|
||||||
|
#define PARSER_ACTION_APC_END 17
|
||||||
|
|
||||||
|
#define PARSER_MAX_OPS 4096
|
||||||
|
#define PARSER_MAX_PARAMS 4096
|
||||||
|
#define PARSER_PARAMS_MAX_LEN 32
|
||||||
|
#define PARSER_SUBPARAMS_MAX_LEN 256
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t current_state;
|
||||||
|
uint32_t collect;
|
||||||
|
uint32_t preceding_join_state;
|
||||||
|
int32_t params[PARSER_PARAMS_MAX_LEN];
|
||||||
|
uint32_t params_len;
|
||||||
|
int32_t subparams[PARSER_SUBPARAMS_MAX_LEN];
|
||||||
|
uint32_t subparams_len;
|
||||||
|
uint16_t subparams_idx[PARSER_PARAMS_MAX_LEN];
|
||||||
|
uint32_t reject_digits;
|
||||||
|
uint32_t reject_sub_digits;
|
||||||
|
uint32_t digit_is_sub;
|
||||||
|
uint32_t osc_start;
|
||||||
|
uint32_t dcs_start;
|
||||||
|
uint32_t apc_start;
|
||||||
|
uint32_t dcs_hook_ident;
|
||||||
|
uint32_t apc_hook_ident;
|
||||||
|
uint32_t osc_term;
|
||||||
|
} ParserWasmState;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t op_count;
|
||||||
|
uint32_t input_len;
|
||||||
|
uint32_t params_arena_len;
|
||||||
|
uint32_t scan_offset;
|
||||||
|
} ParserScanHeader;
|
||||||
|
|
||||||
|
#endif
|
||||||
Executable
BIN
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -0,0 +1,279 @@
|
|||||||
|
/* Auto-generated by bin/gen_parser_transition_table.mjs - do not edit */
|
||||||
|
#ifndef PARSER_TRANSITION_TABLE_H
|
||||||
|
#define PARSER_TRANSITION_TABLE_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define PARSER_TABLE_SIZE 4257
|
||||||
|
|
||||||
|
static const uint16_t PARSER_TRANSITION_TABLE[PARSER_TABLE_SIZE] = {
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0xb01, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200,
|
||||||
|
0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200,
|
||||||
|
0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200,
|
||||||
|
0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200,
|
||||||
|
0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200,
|
||||||
|
0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x100,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0xb09, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x7, 0x300, 0x300, 0xb03, 0x0, 0x408, 0x7, 0xb0e,
|
||||||
|
0x200, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x301, 0x301, 0x301, 0x301, 0x301, 0x301, 0x301, 0x301, 0x301, 0x301, 0x301, 0x301, 0x301, 0x301, 0x301, 0x301,
|
||||||
|
0x301, 0x301, 0x301, 0x301, 0x301, 0x301, 0x301, 0x301, 0x300, 0x301, 0x300, 0xb01, 0x301, 0x301, 0x301, 0x301,
|
||||||
|
0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902,
|
||||||
|
0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00,
|
||||||
|
0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00,
|
||||||
|
0xb09, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0x7, 0xa00, 0xa00, 0xb03, 0xa00, 0x408, 0x7, 0xb0e,
|
||||||
|
0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00,
|
||||||
|
0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0x1,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0xb09, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x7, 0x300, 0x300, 0xb03, 0x0, 0x408, 0x7, 0xb0e,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x302, 0x302, 0x302, 0x302, 0x302, 0x302, 0x302, 0x302, 0x302, 0x302, 0x302, 0x302, 0x302, 0x302, 0x302, 0x302,
|
||||||
|
0x302, 0x302, 0x302, 0x302, 0x302, 0x302, 0x302, 0x302, 0x300, 0x302, 0x300, 0xb01, 0x302, 0x302, 0x302, 0x302,
|
||||||
|
0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902, 0x902,
|
||||||
|
0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00,
|
||||||
|
0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00,
|
||||||
|
0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00,
|
||||||
|
0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00,
|
||||||
|
0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0xa00, 0x2,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0xb09, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x7, 0x300, 0x300, 0xb03, 0x0, 0x408, 0x7, 0xb0e,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x303, 0x303, 0x303, 0x303, 0x303, 0x303, 0x303, 0x303, 0x303, 0x303, 0x303, 0x303, 0x303, 0x303, 0x303, 0x303,
|
||||||
|
0x303, 0x303, 0x303, 0x303, 0x303, 0x303, 0x303, 0x303, 0x300, 0x303, 0x300, 0xb01, 0x303, 0x303, 0x303, 0x303,
|
||||||
|
0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905,
|
||||||
|
0x804, 0x804, 0x804, 0x804, 0x804, 0x804, 0x804, 0x804, 0x804, 0x804, 0x804, 0x804, 0x904, 0x904, 0x904, 0x904,
|
||||||
|
0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700,
|
||||||
|
0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700,
|
||||||
|
0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700,
|
||||||
|
0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x3,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0xb09, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x7, 0x300, 0x300, 0xb03, 0x0, 0x408, 0x7, 0xb0e,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x304, 0x304, 0x304, 0x304, 0x304, 0x304, 0x304, 0x304, 0x304, 0x304, 0x304, 0x304, 0x304, 0x304, 0x304, 0x304,
|
||||||
|
0x304, 0x304, 0x304, 0x304, 0x304, 0x304, 0x304, 0x304, 0x300, 0x304, 0x300, 0xb01, 0x304, 0x304, 0x304, 0x304,
|
||||||
|
0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905,
|
||||||
|
0x804, 0x804, 0x804, 0x804, 0x804, 0x804, 0x804, 0x804, 0x804, 0x804, 0x804, 0x804, 0x6, 0x6, 0x6, 0x6,
|
||||||
|
0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700,
|
||||||
|
0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700,
|
||||||
|
0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700,
|
||||||
|
0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x4,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0xb09, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x7, 0x300, 0x300, 0xb03, 0x0, 0x408, 0x7, 0xb0e,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x305, 0x305, 0x305, 0x305, 0x305, 0x305, 0x305, 0x305, 0x305, 0x305, 0x305, 0x305, 0x305, 0x305, 0x305, 0x305,
|
||||||
|
0x305, 0x305, 0x305, 0x305, 0x305, 0x305, 0x305, 0x305, 0x300, 0x305, 0x300, 0xb01, 0x305, 0x305, 0x305, 0x305,
|
||||||
|
0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905, 0x905,
|
||||||
|
0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6,
|
||||||
|
0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700,
|
||||||
|
0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700,
|
||||||
|
0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700,
|
||||||
|
0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x700, 0x5,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0xb09, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x7, 0x300, 0x300, 0xb03, 0x0, 0x408, 0x7, 0xb0e,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x306, 0x306, 0x306, 0x306, 0x306, 0x306, 0x306, 0x306, 0x306, 0x306, 0x306, 0x306, 0x306, 0x306, 0x306, 0x306,
|
||||||
|
0x306, 0x306, 0x306, 0x306, 0x306, 0x306, 0x306, 0x306, 0x300, 0x306, 0x300, 0xb01, 0x306, 0x306, 0x306, 0x306,
|
||||||
|
0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6,
|
||||||
|
0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6,
|
||||||
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0xb09, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x7, 0x300, 0x300, 0xb03, 0x0, 0x408, 0x7, 0xb0e,
|
||||||
|
0x6, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7,
|
||||||
|
0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x300, 0x7, 0x300, 0xb01, 0x7, 0x7, 0x7, 0x7,
|
||||||
|
0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7,
|
||||||
|
0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7,
|
||||||
|
0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7,
|
||||||
|
0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7,
|
||||||
|
0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7,
|
||||||
|
0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0xb09, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x7, 0x300, 0x300, 0xb03, 0x0, 0x408, 0x7, 0xb0e,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x600, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8,
|
||||||
|
0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x600, 0x8, 0x600, 0x600, 0x8, 0x8, 0x8, 0x8,
|
||||||
|
0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508,
|
||||||
|
0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508,
|
||||||
|
0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508,
|
||||||
|
0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508,
|
||||||
|
0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508,
|
||||||
|
0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508, 0x508,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0xb09, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x7, 0x300, 0x300, 0xb03, 0x600, 0x408, 0x7, 0xb0e,
|
||||||
|
0x508, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9,
|
||||||
|
0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x300, 0x9, 0x300, 0xb01, 0x9, 0x9, 0x9, 0x9,
|
||||||
|
0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c,
|
||||||
|
0x80a, 0x80a, 0x80a, 0x80a, 0x80a, 0x80a, 0x80a, 0x80a, 0x80a, 0x80a, 0x80a, 0x80a, 0x90a, 0x90a, 0x90a, 0x90a,
|
||||||
|
0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d,
|
||||||
|
0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d,
|
||||||
|
0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d,
|
||||||
|
0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0x9,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0xb09, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x7, 0x300, 0x300, 0xb03, 0x0, 0x408, 0x7, 0xb0e,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa,
|
||||||
|
0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x300, 0xa, 0x300, 0xb01, 0xa, 0xa, 0xa, 0xa,
|
||||||
|
0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c,
|
||||||
|
0x80a, 0x80a, 0x80a, 0x80a, 0x80a, 0x80a, 0x80a, 0x80a, 0x80a, 0x80a, 0x80a, 0x80a, 0xb, 0xb, 0xb, 0xb,
|
||||||
|
0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d,
|
||||||
|
0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d,
|
||||||
|
0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d,
|
||||||
|
0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xa,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0xb09, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x7, 0x300, 0x300, 0xb03, 0x0, 0x408, 0x7, 0xb0e,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb,
|
||||||
|
0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0x300, 0xb, 0x300, 0xb01, 0xb, 0xb, 0xb, 0xb,
|
||||||
|
0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb,
|
||||||
|
0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb,
|
||||||
|
0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb,
|
||||||
|
0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb,
|
||||||
|
0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb,
|
||||||
|
0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0xb09, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x7, 0x300, 0x300, 0xb03, 0x0, 0x408, 0x7, 0xb0e,
|
||||||
|
0xb, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc,
|
||||||
|
0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0x300, 0xc, 0x300, 0xb01, 0xc, 0xc, 0xc, 0xc,
|
||||||
|
0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c, 0x90c,
|
||||||
|
0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb,
|
||||||
|
0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d,
|
||||||
|
0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d,
|
||||||
|
0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d,
|
||||||
|
0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc0d, 0xc,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0xb09, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x7, 0x300, 0x300, 0xb03, 0x0, 0x408, 0x7, 0xb0e,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d,
|
||||||
|
0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xe00, 0xd0d, 0xe00, 0xe00, 0xd0d, 0xd0d, 0xd0d, 0xd0d,
|
||||||
|
0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d,
|
||||||
|
0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d,
|
||||||
|
0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d,
|
||||||
|
0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d,
|
||||||
|
0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d,
|
||||||
|
0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd0d, 0xd,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0xb09, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x7, 0x300, 0x300, 0xb03, 0xe00, 0x408, 0x7, 0xb0e,
|
||||||
|
0xd0d, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe,
|
||||||
|
0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0x300, 0xe, 0x300, 0xb01, 0xe, 0xe, 0xe, 0xe,
|
||||||
|
0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f,
|
||||||
|
0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10,
|
||||||
|
0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10,
|
||||||
|
0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10,
|
||||||
|
0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10,
|
||||||
|
0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xe,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0xb09, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x7, 0x300, 0x300, 0xb03, 0x0, 0x408, 0x7, 0xb0e,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf,
|
||||||
|
0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0x300, 0xf, 0x300, 0xb01, 0xf, 0xf, 0xf, 0xf,
|
||||||
|
0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f, 0x90f,
|
||||||
|
0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10,
|
||||||
|
0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10,
|
||||||
|
0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10,
|
||||||
|
0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10,
|
||||||
|
0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf10, 0xf,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0xb09, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x7, 0x300, 0x300, 0xb03, 0x0, 0x408, 0x7, 0xb0e,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100,
|
||||||
|
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x10, 0x10,
|
||||||
|
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1100, 0x10, 0x1100, 0x1100, 0x10, 0x10, 0x10, 0x10,
|
||||||
|
0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010,
|
||||||
|
0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010,
|
||||||
|
0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010,
|
||||||
|
0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010,
|
||||||
|
0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010,
|
||||||
|
0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x10,
|
||||||
|
0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300,
|
||||||
|
0xb09, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x7, 0x300, 0x300, 0xb03, 0x1100, 0x408, 0x7, 0xb0e,
|
||||||
|
0x1010
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { CellData } from '../buffer/CellData';
|
import { CellData } from '../buffer/CellData';
|
||||||
import { IBufferLine, ICellData } from '../buffer/Types';
|
import { IBufferLine, ICellData } from '../Types';
|
||||||
import { IBufferCell as IBufferCellApi, IBufferLine as IBufferLineApi } from '@xterm/xterm';
|
import { IBufferCell as IBufferCellApi, IBufferLine as IBufferLineApi } from '@xterm/xterm';
|
||||||
|
|
||||||
export class BufferLineApiView implements IBufferLineApi {
|
export class BufferLineApiView implements IBufferLineApi {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from '@xterm/xterm';
|
import { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from '@xterm/xterm';
|
||||||
import { BufferApiView } from './BufferApiView';
|
import { BufferApiView } from './BufferApiView';
|
||||||
import { ICoreTerminal } from '../CoreTerminal';
|
import { ICoreTerminal } from '../Types';
|
||||||
import { Disposable } from '../Lifecycle';
|
import { Disposable } from '../Lifecycle';
|
||||||
import { Emitter } from '../Event';
|
import { Emitter } from '../Event';
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { IParams } from '../parser/Types';
|
import { IParams } from '../parser/Types';
|
||||||
import { IDisposable, IFunctionIdentifier, IParser } from '@xterm/xterm';
|
import { IDisposable, IFunctionIdentifier, IParser } from '@xterm/xterm';
|
||||||
import { ICoreTerminal } from '../CoreTerminal';
|
import { ICoreTerminal } from '../Types';
|
||||||
|
|
||||||
export class ParserApi implements IParser {
|
export class ParserApi implements IParser {
|
||||||
constructor(private _core: ICoreTerminal) { }
|
constructor(private _core: ICoreTerminal) { }
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ICoreTerminal } from '../CoreTerminal';
|
import { ICoreTerminal } from '../Types';
|
||||||
import { IUnicodeHandling, IUnicodeVersionProvider } from '@xterm/xterm';
|
import { IUnicodeHandling, IUnicodeVersionProvider } from '@xterm/xterm';
|
||||||
|
|
||||||
export class UnicodeApi implements IUnicodeHandling {
|
export class UnicodeApi implements IUnicodeHandling {
|
||||||
|
|||||||
@@ -4,8 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Disposable } from '../Lifecycle';
|
import { Disposable } from '../Lifecycle';
|
||||||
import { IAttributeData, IBuffer, IBufferLine, IBufferSet } from '../buffer/Types';
|
import { IAttributeData, IBufferLine } from '../Types';
|
||||||
import { BufferSet } from '../buffer/BufferSet';
|
import { BufferSet } from '../buffer/BufferSet';
|
||||||
|
import { IBuffer, IBufferSet } from '../buffer/Types';
|
||||||
import { IBufferService, ILogService, IOptionsService, type IBufferResizeEvent } from './Services';
|
import { IBufferService, ILogService, IOptionsService, type IBufferResizeEvent } from './Services';
|
||||||
import { Emitter } from '../Event';
|
import { Emitter } from '../Event';
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { DecorationLineCache, DecorationService } from './DecorationService';
|
import { DecorationLineCache, DecorationService } from './DecorationService';
|
||||||
import { IMarker } from '../buffer/Types';
|
import { IMarker } from '../Types';
|
||||||
import { Disposable } from '../Lifecycle';
|
import { Disposable } from '../Lifecycle';
|
||||||
import { Emitter } from '../Event';
|
import { Emitter } from '../Event';
|
||||||
import { MockLogService, MockBufferService, MockOptionsService } from '../TestUtils.test';
|
import { MockLogService, MockBufferService, MockOptionsService } from '../TestUtils.test';
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { ICircularList, IDeleteEvent, IInsertEvent } from '../CircularList';
|
import type { IDeleteEvent, IInsertEvent } from '../CircularList';
|
||||||
import { MicrotaskTimer } from '../Async';
|
import { MicrotaskTimer } from '../Async';
|
||||||
import { css } from '../Color';
|
import { css } from '../Color';
|
||||||
import { Disposable, DisposableStore, MutableDisposable, toDisposable } from '../Lifecycle';
|
import { Disposable, DisposableStore, MutableDisposable, toDisposable } from '../Lifecycle';
|
||||||
import { IBufferService, IDecorationService, IInternalDecoration, ILogService } from './Services';
|
import { IBufferService, IDecorationService, IInternalDecoration, ILogService } from './Services';
|
||||||
import { SortedList } from '../SortedList';
|
import { SortedList } from '../SortedList';
|
||||||
import { IColor } from '../Types';
|
import { IColor, ICircularList } from '../Types';
|
||||||
import { IDecoration, IDecorationOptions, IMarker } from '@xterm/xterm';
|
import { IDecoration, IDecorationOptions, IMarker } from '@xterm/xterm';
|
||||||
import { Emitter } from '../Event';
|
import { Emitter } from '../Event';
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { IInstantiationService } from './Services';
|
import { IInstantiationService, IServiceIdentifier } from './Services';
|
||||||
import { IServiceIdentifier, getServiceDependencies } from './ServiceRegistry';
|
import { getServiceDependencies } from './ServiceRegistry';
|
||||||
|
|
||||||
export class ServiceCollection {
|
export class ServiceCollection {
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
import { IBufferService, IOscLinkService } from './Services';
|
import { IBufferService, IOscLinkService } from './Services';
|
||||||
import { IOscLinkData } from '../Types';
|
import { IMarker, IOscLinkData } from '../Types';
|
||||||
import { IMarker } from '../buffer/Types';
|
|
||||||
|
|
||||||
export class OscLinkService implements IOscLinkService {
|
export class OscLinkService implements IOscLinkService {
|
||||||
public serviceBrand: any;
|
public serviceBrand: any;
|
||||||
|
|||||||
@@ -9,11 +9,7 @@
|
|||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
export interface IServiceIdentifier<T> {
|
import { IServiceIdentifier } from './Services';
|
||||||
(...args: any[]): void;
|
|
||||||
type: T;
|
|
||||||
_id: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const enum Constants {
|
const enum Constants {
|
||||||
DI_TARGET = 'di$target',
|
DI_TARGET = 'di$target',
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import type { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty, IOverviewRulerOptions } from '@xterm/xterm';
|
import type { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty, IOverviewRulerOptions } from '@xterm/xterm';
|
||||||
import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IKittyKeyboardState, IModes, IOscLinkData, IWindowOptions } from '../Types';
|
import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IKittyKeyboardState, IModes, IOscLinkData, IWindowOptions } from '../Types';
|
||||||
import { IAttributeData, IBuffer, IBufferSet } from '../buffer/Types';
|
import { IBuffer, IBufferSet } from '../buffer/Types';
|
||||||
import { createDecorator, IServiceIdentifier } from './ServiceRegistry';
|
import { createDecorator } from './ServiceRegistry';
|
||||||
import type { Emitter, IEvent } from '../Event';
|
import type { Emitter, IEvent } from '../Event';
|
||||||
|
|
||||||
export const IBufferService = createDecorator<IBufferService>('BufferService');
|
export const IBufferService = createDecorator<IBufferService>('BufferService');
|
||||||
@@ -119,6 +119,12 @@ export interface ICharsetService {
|
|||||||
setgCharset(g: number, charset: ICharset | undefined): void;
|
setgCharset(g: number, charset: ICharset | undefined): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IServiceIdentifier<T> {
|
||||||
|
(...args: any[]): void;
|
||||||
|
type: T;
|
||||||
|
_id: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface IBrandedService {
|
export interface IBrandedService {
|
||||||
serviceBrand: undefined;
|
serviceBrand: undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { UnicodeV6 } from '../input/UnicodeV6';
|
|
||||||
import { UnicodeService } from './UnicodeService';
|
import { UnicodeService } from './UnicodeService';
|
||||||
import { IUnicodeVersionProvider } from './Services';
|
import { IUnicodeVersionProvider } from './Services';
|
||||||
|
|
||||||
@@ -22,7 +21,6 @@ describe('unicode provider', () => {
|
|||||||
let us: UnicodeService;
|
let us: UnicodeService;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
us = new UnicodeService();
|
us = new UnicodeService();
|
||||||
us.register(new UnicodeV6());
|
|
||||||
});
|
});
|
||||||
it('default to V6', () => {
|
it('default to V6', () => {
|
||||||
assert.equal(us.activeVersion, '6');
|
assert.equal(us.activeVersion, '6');
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { UnicodeV6 } from '../input/UnicodeV6';
|
||||||
import { IUnicodeService, IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from './Services';
|
import { IUnicodeService, IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from './Services';
|
||||||
import { Emitter } from '../Event';
|
import { Emitter } from '../Event';
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ export class UnicodeService implements IUnicodeService {
|
|||||||
|
|
||||||
private _providers: {[key: string]: IUnicodeVersionProvider} = Object.create(null);
|
private _providers: {[key: string]: IUnicodeVersionProvider} = Object.create(null);
|
||||||
private _active: string = '';
|
private _active: string = '';
|
||||||
private _activeProvider!: IUnicodeVersionProvider;
|
private _activeProvider: IUnicodeVersionProvider;
|
||||||
|
|
||||||
private readonly _onChange = new Emitter<string>();
|
private readonly _onChange = new Emitter<string>();
|
||||||
public readonly onChange = this._onChange.event;
|
public readonly onChange = this._onChange.event;
|
||||||
@@ -29,6 +30,13 @@ export class UnicodeService implements IUnicodeService {
|
|||||||
return ((state & 0xffffff) << 3) | ((width & 3) << 1) | (shouldJoin?1:0);
|
return ((state & 0xffffff) << 3) | ((width & 3) << 1) | (shouldJoin?1:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
const defaultProvider = new UnicodeV6();
|
||||||
|
this.register(defaultProvider);
|
||||||
|
this._active = defaultProvider.version;
|
||||||
|
this._activeProvider = defaultProvider;
|
||||||
|
}
|
||||||
|
|
||||||
public dispose(): void {
|
public dispose(): void {
|
||||||
this._onChange.dispose();
|
this._onChange.dispose();
|
||||||
}
|
}
|
||||||
@@ -52,9 +60,6 @@ export class UnicodeService implements IUnicodeService {
|
|||||||
|
|
||||||
public register(provider: IUnicodeVersionProvider): void {
|
public register(provider: IUnicodeVersionProvider): void {
|
||||||
this._providers[provider.version] = provider;
|
this._providers[provider.version] = provider;
|
||||||
if (!this._active) {
|
|
||||||
this.activeVersion = provider.version;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,9 +22,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { DEFAULT_ATTR_DATA } from '../common/buffer/BufferLine';
|
import { DEFAULT_ATTR_DATA } from '../common/buffer/BufferLine';
|
||||||
import { IBuffer, IMarker } from '../common/buffer/Types';
|
import { IBuffer } from '../common/buffer/Types';
|
||||||
import { CoreTerminal } from '../common/CoreTerminal';
|
import { CoreTerminal } from '../common/CoreTerminal';
|
||||||
import { ITerminalOptions } from '../common/Types';
|
import { IMarker, ITerminalOptions } from '../common/Types';
|
||||||
import { Emitter, EventUtils } from '../common/Event';
|
import { Emitter, EventUtils } from '../common/Event';
|
||||||
|
|
||||||
export class Terminal extends CoreTerminal {
|
export class Terminal extends CoreTerminal {
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { perfContext, before, RuntimeCase } from 'xterm-benchmark';
|
import { perfContext, before, RuntimeCase } from 'xterm-benchmark';
|
||||||
import { DecorationService } from '../../src/common/services/DecorationService';
|
import { DecorationService } from '../../out/common/services/DecorationService';
|
||||||
import { MockLogService, MockBufferService, MockOptionsService } from '../../src/common/TestUtils.test';
|
import { MockLogService, MockBufferService, MockOptionsService } from '../../out/common/TestUtils.test';
|
||||||
const enum Constants {
|
const enum Constants {
|
||||||
COLS = 80,
|
COLS = 80,
|
||||||
ROWS = 30,
|
ROWS = 30,
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
*/
|
*/
|
||||||
import { perfContext, before, beforeEach, ThroughputRuntimeCase } from 'xterm-benchmark';
|
import { perfContext, before, beforeEach, ThroughputRuntimeCase } from 'xterm-benchmark';
|
||||||
|
|
||||||
import { EscapeSequenceParser } from '../../src/common/parser/EscapeSequenceParser';
|
import { EscapeSequenceParser } from '../../out/common/parser/EscapeSequenceParser';
|
||||||
import { C0, C1 } from '../../src/common/data/EscapeSequences';
|
import { C0, C1 } from '../../out/common/data/EscapeSequences';
|
||||||
import { IDcsHandler, IOscHandler, IApcHandler, IParams } from '../../src/common/parser/Types';
|
import { IDcsHandler, IOscHandler, IApcHandler, IParams } from '../../out/common/parser/Types';
|
||||||
import { OscHandler } from '../../src/common/parser/OscParser';
|
import { OscHandler } from '../../out/common/parser/OscParser';
|
||||||
import { DcsHandler } from '../../src/common/parser/DcsParser';
|
import { DcsHandler } from '../../out/common/parser/DcsParser';
|
||||||
import { ApcHandler } from '../../src/common/parser/ApcParser';
|
import { ApcHandler } from '../../out/common/parser/ApcParser';
|
||||||
|
|
||||||
const SIZE = 5000000;
|
const SIZE = 5000000;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { perfContext, before, RuntimeCase } from 'xterm-benchmark';
|
import { perfContext, before, RuntimeCase } from 'xterm-benchmark';
|
||||||
import { Emitter } from '../../src/common/Event';
|
import { Emitter } from '../../out/common/Event';
|
||||||
|
|
||||||
const ITERATIONS = 1_000_000;
|
const ITERATIONS = 1_000_000;
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
import { perfContext, before, ThroughputRuntimeCase } from 'xterm-benchmark';
|
import { perfContext, before, ThroughputRuntimeCase } from 'xterm-benchmark';
|
||||||
|
|
||||||
import { spawn } from 'node-pty';
|
import { spawn } from 'node-pty';
|
||||||
import { Utf8ToUtf32, stringFromCodePoint } from '../../src/common/input/TextDecoder';
|
import { Utf8ToUtf32, stringFromCodePoint } from '../../out/common/input/TextDecoder';
|
||||||
import { CoreBrowserTerminal } from '../../src/browser/CoreBrowserTerminal';
|
import { CoreBrowserTerminal } from '../../out/browser/CoreBrowserTerminal';
|
||||||
|
|
||||||
perfContext('Terminal: ls -lR /usr/lib', () => {
|
perfContext('Terminal: ls -lR /usr/lib', () => {
|
||||||
let content = '';
|
let content = '';
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ import { Browser, JSHandle, Page } from '@playwright/test';
|
|||||||
import { deepStrictEqual, strictEqual } from 'assert';
|
import { deepStrictEqual, strictEqual } from 'assert';
|
||||||
import type { IRenderDimensions as IRenderDimensionsInternal } from '../../src/browser/renderer/shared/Types';
|
import type { IRenderDimensions as IRenderDimensionsInternal } from '../../src/browser/renderer/shared/Types';
|
||||||
import type { IRenderService } from '../../src/browser/services/Services';
|
import type { IRenderService } from '../../src/browser/services/Services';
|
||||||
import type { IDisposable } from '../../src/common/Types';
|
import type { ICoreTerminal, IDisposable, IMarker } from '../../src/common/Types';
|
||||||
import type { IMarker } from '../../src/common/buffer/Types';
|
|
||||||
import type { ICoreTerminal } from '../../src/common/CoreTerminal';
|
|
||||||
import * as playwright from '@playwright/test';
|
import * as playwright from '@playwright/test';
|
||||||
import { IBuffer, IBufferCell, IBufferLine, IBufferNamespace, IBufferRange, IDecoration, IDecorationOptions, IModes, IRenderDimensions, ITerminalInitOnlyOptions, ITerminalOptions, Terminal } from '@xterm/xterm';
|
import { IBuffer, IBufferCell, IBufferLine, IBufferNamespace, IBufferRange, IDecoration, IDecorationOptions, IModes, IRenderDimensions, ITerminalInitOnlyOptions, ITerminalOptions, Terminal } from '@xterm/xterm';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user