Merge pull request #2786 from Tyriar/eslint
Migrate from tslint to eslint
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
"dockerFile": "Dockerfile",
|
"dockerFile": "Dockerfile",
|
||||||
"appPort": 3000,
|
"appPort": 3000,
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"editorconfig.editorconfig",
|
"dbaeumer.vscode-eslint",
|
||||||
"ms-vscode.vscode-typescript-tslint-plugin"
|
"editorconfig.editorconfig"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
+146
@@ -0,0 +1,146 @@
|
|||||||
|
module.exports = {
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es6": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"project": [
|
||||||
|
"src/browser/tsconfig.json",
|
||||||
|
"src/common/tsconfig.json",
|
||||||
|
"src/tsconfig.json",
|
||||||
|
"test/api/tsconfig.json",
|
||||||
|
"test/benchmark/tsconfig.json",
|
||||||
|
"addons/xterm-addon-attach/src/tsconfig.json",
|
||||||
|
"addons/xterm-addon-fit/src/tsconfig.json",
|
||||||
|
"addons/xterm-addon-search/src/tsconfig.json",
|
||||||
|
"addons/xterm-addon-unicode11/src/tsconfig.json",
|
||||||
|
"addons/xterm-addon-web-links/src/tsconfig.json",
|
||||||
|
"addons/xterm-addon-webgl/src/tsconfig.json",
|
||||||
|
"addons/xterm-addon-serialize/src/tsconfig.json",
|
||||||
|
"addons/xterm-addon-serialize/benchmark/tsconfig.json"
|
||||||
|
],
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"ignorePatterns": "**/typings/*.d.ts",
|
||||||
|
"plugins": [
|
||||||
|
"@typescript-eslint"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"@typescript-eslint/array-type": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"default": "array-simple",
|
||||||
|
"readonly": "generic"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/class-name-casing": "error",
|
||||||
|
"@typescript-eslint/consistent-type-definitions": "error",
|
||||||
|
"@typescript-eslint/explicit-function-return-type": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"allowExpressions": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/indent": [
|
||||||
|
"error",
|
||||||
|
2
|
||||||
|
],
|
||||||
|
"@typescript-eslint/interface-name-prefix": [
|
||||||
|
"error",
|
||||||
|
"always"
|
||||||
|
],
|
||||||
|
"@typescript-eslint/member-delimiter-style": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"multiline": {
|
||||||
|
"delimiter": "semi",
|
||||||
|
"requireLast": true
|
||||||
|
},
|
||||||
|
"singleline": {
|
||||||
|
"delimiter": "comma",
|
||||||
|
"requireLast": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/naming-convention": [
|
||||||
|
"error",
|
||||||
|
{ "selector": "default", "format": ["camelCase"] },
|
||||||
|
// variableLike
|
||||||
|
{ "selector": "variable", "format": ["camelCase", "UPPER_CASE"] },
|
||||||
|
{ "selector": "variable", "filter": "^I.+Service$", "format": ["PascalCase"], "prefix": ["I"] },
|
||||||
|
// memberLike
|
||||||
|
{ "selector": "memberLike", "modifiers": ["private"], "format": ["camelCase"], "leadingUnderscore": "require" },
|
||||||
|
{ "selector": "memberLike", "modifiers": ["protected"], "format": ["camelCase"], "leadingUnderscore": "require" },
|
||||||
|
{ "selector": "enumMember", "format": ["UPPER_CASE"] },
|
||||||
|
// typeLike
|
||||||
|
{ "selector": "typeLike", "format": ["PascalCase"] },
|
||||||
|
{ "selector": "interface", "format": ["PascalCase"], "prefix": ["I"] },
|
||||||
|
],
|
||||||
|
"@typescript-eslint/prefer-namespace-keyword": "error",
|
||||||
|
"@typescript-eslint/type-annotation-spacing": "error",
|
||||||
|
"@typescript-eslint/quotes": [
|
||||||
|
"error",
|
||||||
|
"single",
|
||||||
|
{ "allowTemplateLiterals": true }
|
||||||
|
],
|
||||||
|
"@typescript-eslint/semi": [
|
||||||
|
"error",
|
||||||
|
"always"
|
||||||
|
],
|
||||||
|
"@typescript-eslint/type-annotation-spacing": "error",
|
||||||
|
"comma-dangle": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"objects": "never",
|
||||||
|
"arrays": "never",
|
||||||
|
"functions": "never"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"curly": [
|
||||||
|
"error",
|
||||||
|
"multi-line"
|
||||||
|
],
|
||||||
|
"eol-last": "error",
|
||||||
|
"eqeqeq": [
|
||||||
|
"error",
|
||||||
|
"always"
|
||||||
|
],
|
||||||
|
"keyword-spacing": "error",
|
||||||
|
"new-parens": "error",
|
||||||
|
"no-duplicate-imports": "error",
|
||||||
|
"no-else-return": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
allowElseIf: false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-eval": "error",
|
||||||
|
"no-irregular-whitespace": "error",
|
||||||
|
"no-restricted-imports": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"patterns": [
|
||||||
|
".*\\/out\\/.*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-trailing-spaces": "error",
|
||||||
|
"no-unsafe-finally": "error",
|
||||||
|
"no-var": "error",
|
||||||
|
"one-var": [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
],
|
||||||
|
"prefer-const": "error",
|
||||||
|
"spaced-comment": [
|
||||||
|
"error",
|
||||||
|
"always",
|
||||||
|
{
|
||||||
|
"markers": ["/"],
|
||||||
|
"exceptions": ["-"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -42,7 +42,6 @@
|
|||||||
*.test.js
|
*.test.js
|
||||||
*.test.js.map
|
*.test.js.map
|
||||||
lib/test/
|
lib/test/
|
||||||
tslint.json
|
|
||||||
webpack.config.js
|
webpack.config.js
|
||||||
|
|
||||||
docs/
|
docs/
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"typescript.preferences.quoteStyle": "single",
|
"typescript.preferences.importModuleSpecifier": "non-relative",
|
||||||
"typescript.preferences.importModuleSpecifier": "non-relative"
|
"typescript.preferences.quoteStyle": "single"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export class FitAddon implements ITerminalAddon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove reliance on private API
|
// TODO: Remove reliance on private API
|
||||||
const core = (<any>this._terminal)._core;
|
const core = (this._terminal as any)._core;
|
||||||
|
|
||||||
// Force a full render
|
// Force a full render
|
||||||
if (this._terminal.rows !== dims.rows || this._terminal.cols !== dims.cols) {
|
if (this._terminal.rows !== dims.rows || this._terminal.cols !== dims.cols) {
|
||||||
@@ -57,7 +57,7 @@ export class FitAddon implements ITerminalAddon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove reliance on private API
|
// TODO: Remove reliance on private API
|
||||||
const core = (<any>this._terminal)._core;
|
const core = (this._terminal as any)._core;
|
||||||
|
|
||||||
const parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement);
|
const parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement);
|
||||||
const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height'));
|
const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height'));
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { SerializeAddon } from 'SerializeAddon';
|
|||||||
|
|
||||||
class TestTerminal extends Terminal {
|
class TestTerminal extends Terminal {
|
||||||
writeSync(data: string): void {
|
writeSync(data: string): void {
|
||||||
(<any>this)._core.writeSync(data);
|
(this as any)._core.writeSync(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export class WebLinksAddon implements ITerminalAddon {
|
|||||||
this._linkProvider = this._terminal.registerLinkProvider(new WebLinkProvider(this._terminal, strictUrlRegex, this._handler));
|
this._linkProvider = this._terminal.registerLinkProvider(new WebLinkProvider(this._terminal, strictUrlRegex, this._handler));
|
||||||
} else {
|
} else {
|
||||||
// TODO: This should be removed eventually
|
// TODO: This should be removed eventually
|
||||||
this._linkMatcherId = (<Terminal>this._terminal).registerLinkMatcher(strictUrlRegex, this._handler, this._options);
|
this._linkMatcherId = (this._terminal as Terminal).registerLinkMatcher(strictUrlRegex, this._handler, this._options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,7 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { sliceFallback } from './TypedArray';
|
import { sliceFallback } from './TypedArray';
|
||||||
|
|
||||||
type TypedArray = Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray
|
type TypedArray = Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array;
|
||||||
| Int8Array | Int16Array | Int32Array
|
|
||||||
| Float32Array | Float64Array;
|
|
||||||
|
|
||||||
function deepEquals(a: TypedArray, b: TypedArray): void {
|
function deepEquals(a: TypedArray, b: TypedArray): void {
|
||||||
assert.equal(a.length, b.length);
|
assert.equal(a.length, b.length);
|
||||||
@@ -40,19 +38,19 @@ describe('polyfill conformance tests', function(): void {
|
|||||||
deepEquals(sliceFallback(u321, -1), u322.slice(-1));
|
deepEquals(sliceFallback(u321, -1), u322.slice(-1));
|
||||||
});
|
});
|
||||||
it('Int8Array', () => {
|
it('Int8Array', () => {
|
||||||
const i81 = new Int8Array(5);
|
const i81 = new Int8Array(5);
|
||||||
const i82 = new Int8Array(5);
|
const i82 = new Int8Array(5);
|
||||||
deepEquals(sliceFallback(i81, 2), i82.slice(2));
|
deepEquals(sliceFallback(i81, 2), i82.slice(2));
|
||||||
deepEquals(sliceFallback(i81, 65537), i82.slice(65537));
|
deepEquals(sliceFallback(i81, 65537), i82.slice(65537));
|
||||||
deepEquals(sliceFallback(i81, -1), i82.slice(-1));
|
deepEquals(sliceFallback(i81, -1), i82.slice(-1));
|
||||||
});
|
});
|
||||||
it('Int16Array', () => {
|
it('Int16Array', () => {
|
||||||
const i161 = new Int16Array(5);
|
const i161 = new Int16Array(5);
|
||||||
const i162 = new Int16Array(5);
|
const i162 = new Int16Array(5);
|
||||||
deepEquals(sliceFallback(i161, 2), i162.slice(2));
|
deepEquals(sliceFallback(i161, 2), i162.slice(2));
|
||||||
deepEquals(sliceFallback(i161, 65535), i162.slice(65535));
|
deepEquals(sliceFallback(i161, 65535), i162.slice(65535));
|
||||||
deepEquals(sliceFallback(i161, -1), i162.slice(-1));
|
deepEquals(sliceFallback(i161, -1), i162.slice(-1));
|
||||||
});
|
});
|
||||||
it('Int32Array', () => {
|
it('Int32Array', () => {
|
||||||
const i321 = new Int32Array(5);
|
const i321 = new Int32Array(5);
|
||||||
const i322 = new Int32Array(5);
|
const i322 = new Int32Array(5);
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type TypedArray = Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray
|
export type TypedArray = Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array;
|
||||||
| Int8Array | Int16Array | Int32Array
|
|
||||||
| Float32Array | Float64Array;
|
|
||||||
|
|
||||||
export function slice<T extends TypedArray>(array: T, start?: number, end?: number): T {
|
export function slice<T extends TypedArray>(array: T, start?: number, end?: number): T {
|
||||||
// all modern engines that support .slice
|
// all modern engines that support .slice
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export class WebglAddon implements ITerminalAddon {
|
|||||||
throw new Error('Cannot activate WebglAddon before Terminal.open');
|
throw new Error('Cannot activate WebglAddon before Terminal.open');
|
||||||
}
|
}
|
||||||
this._terminal = terminal;
|
this._terminal = terminal;
|
||||||
const renderService: IRenderService = (<any>terminal)._core._renderService;
|
const renderService: IRenderService = (<any>terminal)._core._renderService;
|
||||||
const colors: IColorSet = (<any>terminal)._core._colorManager.colors;
|
const colors: IColorSet = (<any>terminal)._core._colorManager.colors;
|
||||||
this._renderer = new WebglRenderer(terminal, colors, this._preserveDrawingBuffer);
|
this._renderer = new WebglRenderer(terminal, colors, this._preserveDrawingBuffer);
|
||||||
renderService.setRenderer(this._renderer);
|
renderService.setRenderer(this._renderer);
|
||||||
@@ -31,8 +31,8 @@ export class WebglAddon implements ITerminalAddon {
|
|||||||
if (!this._terminal) {
|
if (!this._terminal) {
|
||||||
throw new Error('Cannot dispose WebglAddon because it is activated');
|
throw new Error('Cannot dispose WebglAddon because it is activated');
|
||||||
}
|
}
|
||||||
const renderService: IRenderService = (<any>this._terminal)._core._renderService;
|
const renderService: IRenderService = (this._terminal as any)._core._renderService;
|
||||||
renderService.setRenderer((<any>this._terminal)._core._createRenderer());
|
renderService.setRenderer((this._terminal as any)._core._createRenderer());
|
||||||
renderService.onResize(this._terminal.cols, this._terminal.rows);
|
renderService.onResize(this._terminal.cols, this._terminal.rows);
|
||||||
this._renderer = undefined;
|
this._renderer = undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this._core = (<any>this._terminal)._core;
|
this._core = (this._terminal as any)._core;
|
||||||
|
|
||||||
this._renderLayers = [
|
this._renderLayers = [
|
||||||
new LinkRenderLayer(this._core.screenElement, 2, this._colors, this._core),
|
new LinkRenderLayer(this._core.screenElement, 2, this._colors, this._core),
|
||||||
@@ -81,7 +81,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|||||||
};
|
};
|
||||||
this._gl = this._canvas.getContext('webgl2', contextAttributes) as IWebGL2RenderingContext;
|
this._gl = this._canvas.getContext('webgl2', contextAttributes) as IWebGL2RenderingContext;
|
||||||
if (!this._gl) {
|
if (!this._gl) {
|
||||||
throw new Error('WebGL2 not supported ' + this._gl);
|
throw new Error('WebGL2 not supported ' + this._gl);
|
||||||
}
|
}
|
||||||
this._core.screenElement.appendChild(this._canvas);
|
this._core.screenElement.appendChild(this._canvas);
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|||||||
|
|
||||||
public renderRows(start: number, end: number): void {
|
public renderRows(start: number, end: number): void {
|
||||||
if (!this._isAttached) {
|
if (!this._isAttached) {
|
||||||
if (document.body.contains(this._core.screenElement) && (<any>this._core)._charSizeService.width && (<any>this._core)._charSizeService.height) {
|
if (document.body.contains(this._core.screenElement) && (this._core as any)._charSizeService.width && (this._core as any)._charSizeService.height) {
|
||||||
this._updateDimensions();
|
this._updateDimensions();
|
||||||
this._refreshCharAtlas();
|
this._refreshCharAtlas();
|
||||||
this._isAttached = true;
|
this._isAttached = true;
|
||||||
@@ -329,7 +329,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|||||||
// TODO: Acquire CharSizeService properly
|
// TODO: Acquire CharSizeService properly
|
||||||
|
|
||||||
// Perform a new measure if the CharMeasure dimensions are not yet available
|
// Perform a new measure if the CharMeasure dimensions are not yet available
|
||||||
if (!(<any>this._core)._charSizeService.width || !(<any>this._core)._charSizeService.height) {
|
if (!(this._core as any)._charSizeService.width || !(this._core as any)._charSizeService.height) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,12 +340,12 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|||||||
|
|
||||||
// NOTE: ceil fixes sometime, floor does others :s
|
// NOTE: ceil fixes sometime, floor does others :s
|
||||||
|
|
||||||
this.dimensions.scaledCharWidth = Math.floor((<any>this._core)._charSizeService.width * this._devicePixelRatio);
|
this.dimensions.scaledCharWidth = Math.floor((this._core as any)._charSizeService.width * this._devicePixelRatio);
|
||||||
|
|
||||||
// Calculate the scaled character height. Height is ceiled in case
|
// Calculate the scaled character height. Height is ceiled in case
|
||||||
// devicePixelRatio is a floating point number in order to ensure there is
|
// devicePixelRatio is a floating point number in order to ensure there is
|
||||||
// enough space to draw the character to the cell.
|
// enough space to draw the character to the cell.
|
||||||
this.dimensions.scaledCharHeight = Math.ceil((<any>this._core)._charSizeService.height * this._devicePixelRatio);
|
this.dimensions.scaledCharHeight = Math.ceil((this._core as any)._charSizeService.height * this._devicePixelRatio);
|
||||||
|
|
||||||
// Calculate the scaled cell height, if lineHeight is not 1 then the value
|
// Calculate the scaled cell height, if lineHeight is not 1 then the value
|
||||||
// will be floored because since lineHeight can never be lower then 1, there
|
// will be floored because since lineHeight can never be lower then 1, there
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
const oldCanvas = this._canvas;
|
const oldCanvas = this._canvas;
|
||||||
this._alpha = alpha;
|
this._alpha = alpha;
|
||||||
// Cloning preserves properties
|
// Cloning preserves properties
|
||||||
this._canvas = <HTMLCanvasElement>this._canvas.cloneNode();
|
this._canvas = this._canvas.cloneNode() as HTMLCanvasElement;
|
||||||
this._initCanvas();
|
this._initCanvas();
|
||||||
this._container.replaceChild(this._canvas, oldCanvas);
|
this._container.replaceChild(this._canvas, oldCanvas);
|
||||||
|
|
||||||
@@ -127,10 +127,10 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
*/
|
*/
|
||||||
protected _fillCells(x: number, y: number, width: number, height: number): void {
|
protected _fillCells(x: number, y: number, width: number, height: number): void {
|
||||||
this._ctx.fillRect(
|
this._ctx.fillRect(
|
||||||
x * this._scaledCellWidth,
|
x * this._scaledCellWidth,
|
||||||
y * this._scaledCellHeight,
|
y * this._scaledCellHeight,
|
||||||
width * this._scaledCellWidth,
|
width * this._scaledCellWidth,
|
||||||
height * this._scaledCellHeight);
|
height * this._scaledCellHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,10 +141,10 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
*/
|
*/
|
||||||
protected _fillBottomLineAtCells(x: number, y: number, width: number = 1): void {
|
protected _fillBottomLineAtCells(x: number, y: number, width: number = 1): void {
|
||||||
this._ctx.fillRect(
|
this._ctx.fillRect(
|
||||||
x * this._scaledCellWidth,
|
x * this._scaledCellWidth,
|
||||||
(y + 1) * this._scaledCellHeight - window.devicePixelRatio - 1 /* Ensure it's drawn within the cell */,
|
(y + 1) * this._scaledCellHeight - window.devicePixelRatio - 1 /* Ensure it's drawn within the cell */,
|
||||||
width * this._scaledCellWidth,
|
width * this._scaledCellWidth,
|
||||||
window.devicePixelRatio);
|
window.devicePixelRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -155,10 +155,10 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
*/
|
*/
|
||||||
protected _fillLeftLineAtCell(x: number, y: number, width: number): void {
|
protected _fillLeftLineAtCell(x: number, y: number, width: number): void {
|
||||||
this._ctx.fillRect(
|
this._ctx.fillRect(
|
||||||
x * this._scaledCellWidth,
|
x * this._scaledCellWidth,
|
||||||
y * this._scaledCellHeight,
|
y * this._scaledCellHeight,
|
||||||
window.devicePixelRatio * width,
|
window.devicePixelRatio * width,
|
||||||
this._scaledCellHeight);
|
this._scaledCellHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -170,10 +170,10 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
protected _strokeRectAtCell(x: number, y: number, width: number, height: number): void {
|
protected _strokeRectAtCell(x: number, y: number, width: number, height: number): void {
|
||||||
this._ctx.lineWidth = window.devicePixelRatio;
|
this._ctx.lineWidth = window.devicePixelRatio;
|
||||||
this._ctx.strokeRect(
|
this._ctx.strokeRect(
|
||||||
x * this._scaledCellWidth + window.devicePixelRatio / 2,
|
x * this._scaledCellWidth + window.devicePixelRatio / 2,
|
||||||
y * this._scaledCellHeight + (window.devicePixelRatio / 2),
|
y * this._scaledCellHeight + (window.devicePixelRatio / 2),
|
||||||
width * this._scaledCellWidth - window.devicePixelRatio,
|
width * this._scaledCellWidth - window.devicePixelRatio,
|
||||||
(height * this._scaledCellHeight) - window.devicePixelRatio);
|
(height * this._scaledCellHeight) - window.devicePixelRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -198,17 +198,17 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
protected _clearCells(x: number, y: number, width: number, height: number): void {
|
protected _clearCells(x: number, y: number, width: number, height: number): void {
|
||||||
if (this._alpha) {
|
if (this._alpha) {
|
||||||
this._ctx.clearRect(
|
this._ctx.clearRect(
|
||||||
x * this._scaledCellWidth,
|
x * this._scaledCellWidth,
|
||||||
y * this._scaledCellHeight,
|
y * this._scaledCellHeight,
|
||||||
width * this._scaledCellWidth,
|
width * this._scaledCellWidth,
|
||||||
height * this._scaledCellHeight);
|
height * this._scaledCellHeight);
|
||||||
} else {
|
} else {
|
||||||
this._ctx.fillStyle = this._colors.background.css;
|
this._ctx.fillStyle = this._colors.background.css;
|
||||||
this._ctx.fillRect(
|
this._ctx.fillRect(
|
||||||
x * this._scaledCellWidth,
|
x * this._scaledCellWidth,
|
||||||
y * this._scaledCellHeight,
|
y * this._scaledCellHeight,
|
||||||
width * this._scaledCellWidth,
|
width * this._scaledCellWidth,
|
||||||
height * this._scaledCellHeight);
|
height * this._scaledCellHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,9 +227,9 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
this._ctx.textBaseline = 'middle';
|
this._ctx.textBaseline = 'middle';
|
||||||
this._clipRow(terminal, y);
|
this._clipRow(terminal, y);
|
||||||
this._ctx.fillText(
|
this._ctx.fillText(
|
||||||
cell.getChars(),
|
cell.getChars(),
|
||||||
x * this._scaledCellWidth + this._scaledCharLeft,
|
x * this._scaledCellWidth + this._scaledCharLeft,
|
||||||
y * this._scaledCellHeight + this._scaledCharTop + this._scaledCharHeight / 2);
|
y * this._scaledCellHeight + this._scaledCharTop + this._scaledCharHeight / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -240,10 +240,10 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
private _clipRow(terminal: Terminal, y: number): void {
|
private _clipRow(terminal: Terminal, y: number): void {
|
||||||
this._ctx.beginPath();
|
this._ctx.beginPath();
|
||||||
this._ctx.rect(
|
this._ctx.rect(
|
||||||
0,
|
0,
|
||||||
y * this._scaledCellHeight,
|
y * this._scaledCellHeight,
|
||||||
terminal.cols * this._scaledCellWidth,
|
terminal.cols * this._scaledCellWidth,
|
||||||
this._scaledCellHeight);
|
this._scaledCellHeight);
|
||||||
this._ctx.clip();
|
this._ctx.clip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -11,7 +11,7 @@
|
|||||||
"prepackage": "npm run build",
|
"prepackage": "npm run build",
|
||||||
"package": "webpack",
|
"package": "webpack",
|
||||||
"start": "node demo/start",
|
"start": "node demo/start",
|
||||||
"lint": "tslint 'src/**/*.ts' 'addons/*/src/**/*.ts'",
|
"lint": "eslint -c .eslintrc.js --ext .ts src/ addons/",
|
||||||
"test": "npm run test-unit",
|
"test": "npm run test-unit",
|
||||||
"posttest": "npm run lint",
|
"posttest": "npm run lint",
|
||||||
"test-api": "npm run test-api-chromium",
|
"test-api": "npm run test-api-chromium",
|
||||||
@@ -46,8 +46,11 @@
|
|||||||
"@types/utf8": "^2.1.6",
|
"@types/utf8": "^2.1.6",
|
||||||
"@types/webpack": "^4.4.11",
|
"@types/webpack": "^4.4.11",
|
||||||
"@types/ws": "^6.0.1",
|
"@types/ws": "^6.0.1",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^2.25.0",
|
||||||
|
"@typescript-eslint/parser": "^2.25.0",
|
||||||
"chai": "3.5.0",
|
"chai": "3.5.0",
|
||||||
"deep-equal": "^2.0.1",
|
"deep-equal": "^2.0.1",
|
||||||
|
"eslint": "^6.8.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"express-ws": "^4.0.0",
|
"express-ws": "^4.0.0",
|
||||||
"glob": "^7.0.5",
|
"glob": "^7.0.5",
|
||||||
@@ -59,8 +62,6 @@
|
|||||||
"playwright-core": "^0.11.1",
|
"playwright-core": "^0.11.1",
|
||||||
"source-map-loader": "^0.2.4",
|
"source-map-loader": "^0.2.4",
|
||||||
"ts-loader": "^6.0.4",
|
"ts-loader": "^6.0.4",
|
||||||
"tslint": "^5.18.0",
|
|
||||||
"tslint-consistent-codestyle": "^1.13.0",
|
|
||||||
"typescript": "3.8",
|
"typescript": "3.8",
|
||||||
"utf8": "^3.0.0",
|
"utf8": "^3.0.0",
|
||||||
"webpack": "^4.35.3",
|
"webpack": "^4.35.3",
|
||||||
|
|||||||
+2
-2
@@ -1998,7 +1998,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
this._coreMouseService.activeEncoding = 'DEFAULT';
|
this._coreMouseService.activeEncoding = 'DEFAULT';
|
||||||
break;
|
break;
|
||||||
case 1015: // urxvt ext mode mouse - removed in #2507
|
case 1015: // urxvt ext mode mouse - removed in #2507
|
||||||
this._logService.debug('DECRST 1015 not supported (see #2507)');
|
this._logService.debug('DECRST 1015 not supported (see #2507)');
|
||||||
break;
|
break;
|
||||||
case 25: // hide cursor
|
case 25: // hide cursor
|
||||||
this._coreService.isCursorHidden = true;
|
this._coreService.isCursorHidden = true;
|
||||||
@@ -2007,7 +2007,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
this.restoreCursor();
|
this.restoreCursor();
|
||||||
break;
|
break;
|
||||||
case 1049: // alt screen buffer cursor
|
case 1049: // alt screen buffer cursor
|
||||||
// FALL-THROUGH
|
// FALL-THROUGH
|
||||||
case 47: // normal screen buffer
|
case 47: // normal screen buffer
|
||||||
case 1047: // normal screen buffer - clearing it first
|
case 1047: // normal screen buffer - clearing it first
|
||||||
// Ensure the selection manager has the correct buffer
|
// Ensure the selection manager has the correct buffer
|
||||||
|
|||||||
+5
-7
@@ -419,7 +419,7 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
|
|||||||
}
|
}
|
||||||
copyHandler(event, this._selectionService);
|
copyHandler(event, this._selectionService);
|
||||||
}));
|
}));
|
||||||
const pasteHandlerWrapper = (event: ClipboardEvent) => handlePasteEvent(event, this.textarea, this.bracketedPasteMode, this._coreService);
|
const pasteHandlerWrapper = (event: ClipboardEvent): void => handlePasteEvent(event, this.textarea, this.bracketedPasteMode, this._coreService);
|
||||||
this.register(addDisposableDomListener(this.textarea, 'paste', pasteHandlerWrapper));
|
this.register(addDisposableDomListener(this.textarea, 'paste', pasteHandlerWrapper));
|
||||||
this.register(addDisposableDomListener(this.element, 'paste', pasteHandlerWrapper));
|
this.register(addDisposableDomListener(this.element, 'paste', pasteHandlerWrapper));
|
||||||
|
|
||||||
@@ -663,10 +663,8 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
|
|||||||
|
|
||||||
// send event to CoreMouseService
|
// send event to CoreMouseService
|
||||||
function sendEvent(ev: MouseEvent | WheelEvent): boolean {
|
function sendEvent(ev: MouseEvent | WheelEvent): boolean {
|
||||||
let pos;
|
|
||||||
|
|
||||||
// get mouse coordinates
|
// get mouse coordinates
|
||||||
pos = self._mouseService.getRawByteCoords(ev, self.screenElement, self.cols, self.rows);
|
const pos = self._mouseService.getRawByteCoords(ev, self.screenElement, self.cols, self.rows);
|
||||||
if (!pos) {
|
if (!pos) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -685,8 +683,8 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
|
|||||||
} else {
|
} else {
|
||||||
// according to MDN buttons only reports up to button 5 (AUX2)
|
// according to MDN buttons only reports up to button 5 (AUX2)
|
||||||
but = ev.buttons & 1 ? CoreMouseButton.LEFT :
|
but = ev.buttons & 1 ? CoreMouseButton.LEFT :
|
||||||
ev.buttons & 4 ? CoreMouseButton.MIDDLE :
|
ev.buttons & 4 ? CoreMouseButton.MIDDLE :
|
||||||
ev.buttons & 2 ? CoreMouseButton.RIGHT :
|
ev.buttons & 2 ? CoreMouseButton.RIGHT :
|
||||||
CoreMouseButton.NONE; // fallback to NONE
|
CoreMouseButton.NONE; // fallback to NONE
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -987,7 +985,7 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
|
|||||||
} else {
|
} else {
|
||||||
// scrollTop is non-zero which means no line will be going to the
|
// scrollTop is non-zero which means no line will be going to the
|
||||||
// scrollback, instead we can just shift them in-place.
|
// scrollback, instead we can just shift them in-place.
|
||||||
const scrollRegionHeight = bottomRow - topRow + 1/*as it's zero-based*/;
|
const scrollRegionHeight = bottomRow - topRow + 1 /* as it's zero-based */;
|
||||||
this.buffer.lines.shiftElements(topRow + 1, scrollRegionHeight - 1, -1);
|
this.buffer.lines.shiftElements(topRow + 1, scrollRegionHeight - 1, -1);
|
||||||
this.buffer.lines.set(bottomRow, newLine.clone());
|
this.buffer.lines.set(bottomRow, newLine.clone());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ export class MockTerminal implements ITerminal {
|
|||||||
onBinary: IEvent<string>;
|
onBinary: IEvent<string>;
|
||||||
onTitleChange: IEvent<string>;
|
onTitleChange: IEvent<string>;
|
||||||
onScroll: IEvent<number>;
|
onScroll: IEvent<number>;
|
||||||
onKey: IEvent<{ key: string; domEvent: KeyboardEvent; }>;
|
onKey: IEvent<{ key: string, domEvent: KeyboardEvent }>;
|
||||||
onRender: IEvent<{ start: number; end: number; }>;
|
onRender: IEvent<{ start: number, end: number }>;
|
||||||
onResize: IEvent<{ cols: number; rows: number; }>;
|
onResize: IEvent<{ cols: number, rows: number }>;
|
||||||
markers: IMarker[];
|
markers: IMarker[];
|
||||||
optionsService: IOptionsService;
|
optionsService: IOptionsService;
|
||||||
unicodeService: IUnicodeService;
|
unicodeService: IUnicodeService;
|
||||||
@@ -251,7 +251,7 @@ export class MockBuffer implements IBuffer {
|
|||||||
translateBufferLineToString(lineIndex: number, trimRight: boolean, startCol?: number, endCol?: number): string {
|
translateBufferLineToString(lineIndex: number, trimRight: boolean, startCol?: number, endCol?: number): string {
|
||||||
return Buffer.prototype.translateBufferLineToString.apply(this, arguments);
|
return Buffer.prototype.translateBufferLineToString.apply(this, arguments);
|
||||||
}
|
}
|
||||||
getWrappedRangeForLine(y: number): { first: number; last: number; } {
|
getWrappedRangeForLine(y: number): { first: number, last: number } {
|
||||||
return Buffer.prototype.getWrappedRangeForLine.apply(this, arguments);
|
return Buffer.prototype.getWrappedRangeForLine.apply(this, arguments);
|
||||||
}
|
}
|
||||||
nextStop(x?: number): number {
|
nextStop(x?: number): number {
|
||||||
@@ -282,8 +282,8 @@ export class MockBuffer implements IBuffer {
|
|||||||
|
|
||||||
export class MockRenderer implements IRenderer {
|
export class MockRenderer implements IRenderer {
|
||||||
onRequestRefreshRows: IEvent<IRequestRefreshRowsEvent>;
|
onRequestRefreshRows: IEvent<IRequestRefreshRowsEvent>;
|
||||||
onCanvasResize: IEvent<{ width: number; height: number; }>;
|
onCanvasResize: IEvent<{ width: number, height: number }>;
|
||||||
onRender: IEvent<{ start: number; end: number; }>;
|
onRender: IEvent<{ start: number, end: number }>;
|
||||||
dispose(): void {
|
dispose(): void {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,5 +3,8 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// eslint-disable-next-line prefer-const
|
||||||
export let promptLabel = 'Terminal input';
|
export let promptLabel = 'Terminal input';
|
||||||
|
|
||||||
|
// eslint-disable-next-line prefer-const
|
||||||
export let tooMuchOutput = 'Too much output to announce, navigate to rows manually to read';
|
export let tooMuchOutput = 'Too much output to announce, navigate to rows manually to read';
|
||||||
|
|||||||
@@ -87,7 +87,8 @@ export class CompositionHelper {
|
|||||||
if (ev.keyCode === 229) {
|
if (ev.keyCode === 229) {
|
||||||
// Continue composing if the keyCode is the "composition character"
|
// Continue composing if the keyCode is the "composition character"
|
||||||
return false;
|
return false;
|
||||||
} else if (ev.keyCode === 16 || ev.keyCode === 17 || ev.keyCode === 18) {
|
}
|
||||||
|
if (ev.keyCode === 16 || ev.keyCode === 17 || ev.keyCode === 18) {
|
||||||
// Continue composing if the keyCode is a modifier key
|
// Continue composing if the keyCode is a modifier key
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export function moveToCellSequence(targetX: number, targetY: number, bufferServi
|
|||||||
direction = startY > targetY ? Direction.LEFT : Direction.RIGHT;
|
direction = startY > targetY ? Direction.LEFT : Direction.RIGHT;
|
||||||
const rowDifference = Math.abs(startY - targetY);
|
const rowDifference = Math.abs(startY - targetY);
|
||||||
const cellsToMove = colsFromRowEnd(startY > targetY ? targetX : startX, bufferService) +
|
const cellsToMove = colsFromRowEnd(startY > targetY ? targetX : startX, bufferService) +
|
||||||
(rowDifference - 1) * bufferService.cols + 1 /*wrap around 1 row*/ +
|
(rowDifference - 1) * bufferService.cols + 1 /* wrap around 1 row */ +
|
||||||
colsFromRowBeginning(startY > targetY ? startX : targetX, bufferService);
|
colsFromRowBeginning(startY > targetY ? startX : targetX, bufferService);
|
||||||
return repeat(cellsToMove, sequence(direction, applicationCursor));
|
return repeat(cellsToMove, sequence(direction, applicationCursor));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
const oldCanvas = this._canvas;
|
const oldCanvas = this._canvas;
|
||||||
this._alpha = alpha;
|
this._alpha = alpha;
|
||||||
// Cloning preserves properties
|
// Cloning preserves properties
|
||||||
this._canvas = <HTMLCanvasElement>this._canvas.cloneNode();
|
this._canvas = this._canvas.cloneNode() as HTMLCanvasElement;
|
||||||
this._initCanvas();
|
this._initCanvas();
|
||||||
this._container.replaceChild(this._canvas, oldCanvas);
|
this._container.replaceChild(this._canvas, oldCanvas);
|
||||||
|
|
||||||
@@ -145,10 +145,10 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
*/
|
*/
|
||||||
protected _fillCells(x: number, y: number, width: number, height: number): void {
|
protected _fillCells(x: number, y: number, width: number, height: number): void {
|
||||||
this._ctx.fillRect(
|
this._ctx.fillRect(
|
||||||
x * this._scaledCellWidth,
|
x * this._scaledCellWidth,
|
||||||
y * this._scaledCellHeight,
|
y * this._scaledCellHeight,
|
||||||
width * this._scaledCellWidth,
|
width * this._scaledCellWidth,
|
||||||
height * this._scaledCellHeight);
|
height * this._scaledCellHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,10 +159,10 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
*/
|
*/
|
||||||
protected _fillBottomLineAtCells(x: number, y: number, width: number = 1): void {
|
protected _fillBottomLineAtCells(x: number, y: number, width: number = 1): void {
|
||||||
this._ctx.fillRect(
|
this._ctx.fillRect(
|
||||||
x * this._scaledCellWidth,
|
x * this._scaledCellWidth,
|
||||||
(y + 1) * this._scaledCellHeight - window.devicePixelRatio - 1 /* Ensure it's drawn within the cell */,
|
(y + 1) * this._scaledCellHeight - window.devicePixelRatio - 1 /* Ensure it's drawn within the cell */,
|
||||||
width * this._scaledCellWidth,
|
width * this._scaledCellWidth,
|
||||||
window.devicePixelRatio);
|
window.devicePixelRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -173,10 +173,10 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
*/
|
*/
|
||||||
protected _fillLeftLineAtCell(x: number, y: number, width: number): void {
|
protected _fillLeftLineAtCell(x: number, y: number, width: number): void {
|
||||||
this._ctx.fillRect(
|
this._ctx.fillRect(
|
||||||
x * this._scaledCellWidth,
|
x * this._scaledCellWidth,
|
||||||
y * this._scaledCellHeight,
|
y * this._scaledCellHeight,
|
||||||
window.devicePixelRatio * width,
|
window.devicePixelRatio * width,
|
||||||
this._scaledCellHeight);
|
this._scaledCellHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -188,10 +188,10 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
protected _strokeRectAtCell(x: number, y: number, width: number, height: number): void {
|
protected _strokeRectAtCell(x: number, y: number, width: number, height: number): void {
|
||||||
this._ctx.lineWidth = window.devicePixelRatio;
|
this._ctx.lineWidth = window.devicePixelRatio;
|
||||||
this._ctx.strokeRect(
|
this._ctx.strokeRect(
|
||||||
x * this._scaledCellWidth + window.devicePixelRatio / 2,
|
x * this._scaledCellWidth + window.devicePixelRatio / 2,
|
||||||
y * this._scaledCellHeight + (window.devicePixelRatio / 2),
|
y * this._scaledCellHeight + (window.devicePixelRatio / 2),
|
||||||
width * this._scaledCellWidth - window.devicePixelRatio,
|
width * this._scaledCellWidth - window.devicePixelRatio,
|
||||||
(height * this._scaledCellHeight) - window.devicePixelRatio);
|
(height * this._scaledCellHeight) - window.devicePixelRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -216,17 +216,17 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
protected _clearCells(x: number, y: number, width: number, height: number): void {
|
protected _clearCells(x: number, y: number, width: number, height: number): void {
|
||||||
if (this._alpha) {
|
if (this._alpha) {
|
||||||
this._ctx.clearRect(
|
this._ctx.clearRect(
|
||||||
x * this._scaledCellWidth,
|
x * this._scaledCellWidth,
|
||||||
y * this._scaledCellHeight,
|
y * this._scaledCellHeight,
|
||||||
width * this._scaledCellWidth,
|
width * this._scaledCellWidth,
|
||||||
height * this._scaledCellHeight);
|
height * this._scaledCellHeight);
|
||||||
} else {
|
} else {
|
||||||
this._ctx.fillStyle = this._colors.background.css;
|
this._ctx.fillStyle = this._colors.background.css;
|
||||||
this._ctx.fillRect(
|
this._ctx.fillRect(
|
||||||
x * this._scaledCellWidth,
|
x * this._scaledCellWidth,
|
||||||
y * this._scaledCellHeight,
|
y * this._scaledCellHeight,
|
||||||
width * this._scaledCellWidth,
|
width * this._scaledCellWidth,
|
||||||
height * this._scaledCellHeight);
|
height * this._scaledCellHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,9 +244,9 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
this._ctx.textBaseline = 'middle';
|
this._ctx.textBaseline = 'middle';
|
||||||
this._clipRow(y);
|
this._clipRow(y);
|
||||||
this._ctx.fillText(
|
this._ctx.fillText(
|
||||||
cell.getChars(),
|
cell.getChars(),
|
||||||
x * this._scaledCellWidth + this._scaledCharLeft,
|
x * this._scaledCellWidth + this._scaledCharLeft,
|
||||||
y * this._scaledCellHeight + this._scaledCharTop + this._scaledCharHeight / 2);
|
y * this._scaledCellHeight + this._scaledCharTop + this._scaledCharHeight / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -359,9 +359,9 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
}
|
}
|
||||||
// Draw the character
|
// Draw the character
|
||||||
this._ctx.fillText(
|
this._ctx.fillText(
|
||||||
cell.getChars(),
|
cell.getChars(),
|
||||||
x * this._scaledCellWidth + this._scaledCharLeft,
|
x * this._scaledCellWidth + this._scaledCharLeft,
|
||||||
y * this._scaledCellHeight + this._scaledCharTop + this._scaledCharHeight / 2);
|
y * this._scaledCellHeight + this._scaledCharTop + this._scaledCharHeight / 2);
|
||||||
this._ctx.restore();
|
this._ctx.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,10 +372,10 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
private _clipRow(y: number): void {
|
private _clipRow(y: number): void {
|
||||||
this._ctx.beginPath();
|
this._ctx.beginPath();
|
||||||
this._ctx.rect(
|
this._ctx.rect(
|
||||||
0,
|
0,
|
||||||
y * this._scaledCellHeight,
|
y * this._scaledCellHeight,
|
||||||
this._bufferService.cols * this._scaledCellWidth,
|
this._bufferService.cols * this._scaledCellWidth,
|
||||||
this._scaledCellHeight);
|
this._scaledCellHeight);
|
||||||
this._ctx.clip();
|
this._ctx.clip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,8 @@ export class DynamicCharAtlas extends BaseCharAtlas {
|
|||||||
if (cacheValue !== null && cacheValue !== undefined) {
|
if (cacheValue !== null && cacheValue !== undefined) {
|
||||||
this._drawFromCache(ctx, cacheValue, x, y);
|
this._drawFromCache(ctx, cacheValue, x, y);
|
||||||
return true;
|
return true;
|
||||||
} else if (this._drawToCacheCount < FRAME_CACHE_DRAW_LIMIT) {
|
}
|
||||||
|
if (this._drawToCacheCount < FRAME_CACHE_DRAW_LIMIT) {
|
||||||
let index;
|
let index;
|
||||||
if (this._cacheMap.size < this._cacheMap.capacity) {
|
if (this._cacheMap.size < this._cacheMap.capacity) {
|
||||||
index = this._cacheMap.size;
|
index = this._cacheMap.size;
|
||||||
@@ -213,9 +214,11 @@ export class DynamicCharAtlas extends BaseCharAtlas {
|
|||||||
// transparent in the atlas. Otherwise we'd end up drawing the transparent background twice
|
// transparent in the atlas. Otherwise we'd end up drawing the transparent background twice
|
||||||
// around the anti-aliased edges of the glyph, and it would look too dark.
|
// around the anti-aliased edges of the glyph, and it would look too dark.
|
||||||
return TRANSPARENT_COLOR;
|
return TRANSPARENT_COLOR;
|
||||||
} else if (glyph.bg === INVERTED_DEFAULT_COLOR) {
|
}
|
||||||
|
if (glyph.bg === INVERTED_DEFAULT_COLOR) {
|
||||||
return this._config.colors.foreground;
|
return this._config.colors.foreground;
|
||||||
} else if (glyph.bg < 256) {
|
}
|
||||||
|
if (glyph.bg < 256) {
|
||||||
return this._getColorFromAnsiIndex(glyph.bg);
|
return this._getColorFromAnsiIndex(glyph.bg);
|
||||||
}
|
}
|
||||||
return this._config.colors.background;
|
return this._config.colors.background;
|
||||||
@@ -224,7 +227,8 @@ export class DynamicCharAtlas extends BaseCharAtlas {
|
|||||||
private _getForegroundColor(glyph: IGlyphIdentifier): IColor {
|
private _getForegroundColor(glyph: IGlyphIdentifier): IColor {
|
||||||
if (glyph.fg === INVERTED_DEFAULT_COLOR) {
|
if (glyph.fg === INVERTED_DEFAULT_COLOR) {
|
||||||
return color.opaque(this._config.colors.background);
|
return color.opaque(this._config.colors.background);
|
||||||
} else if (glyph.fg < 256) {
|
}
|
||||||
|
if (glyph.fg < 256) {
|
||||||
// 256 color support
|
// 256 color support
|
||||||
return this._getColorFromAnsiIndex(glyph.fg);
|
return this._getColorFromAnsiIndex(glyph.fg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -835,12 +835,12 @@ export class SelectionService implements ISelectionService {
|
|||||||
// Calculate the length in _columns_, converting the the string indexes back
|
// Calculate the length in _columns_, converting the the string indexes back
|
||||||
// to column coordinates.
|
// to column coordinates.
|
||||||
let length = Math.min(this._bufferService.cols, // Disallow lengths larger than the terminal cols
|
let length = Math.min(this._bufferService.cols, // Disallow lengths larger than the terminal cols
|
||||||
endIndex // The index of the selection's end char in the line string
|
endIndex // The index of the selection's end char in the line string
|
||||||
- startIndex // The index of the selection's start char in the line string
|
- startIndex // The index of the selection's start char in the line string
|
||||||
+ leftWideCharCount // The number of wide chars left of the initial char
|
+ leftWideCharCount // The number of wide chars left of the initial char
|
||||||
+ rightWideCharCount // The number of wide chars right of the initial char (inclusive)
|
+ rightWideCharCount // The number of wide chars right of the initial char (inclusive)
|
||||||
- leftLongCharOffset // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)
|
- leftLongCharOffset // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)
|
||||||
- rightLongCharOffset); // The number of additional chars right of the initial char (inclusive) added by columns with strings longer than 1 (emojis)
|
- rightLongCharOffset); // The number of additional chars right of the initial char (inclusive) added by columns with strings longer than 1 (emojis)
|
||||||
|
|
||||||
if (!allowWhitespaceOnlySelection && line.slice(startIndex, endIndex).trim() === '') {
|
if (!allowWhitespaceOnlySelection && line.slice(startIndex, endIndex).trim() === '') {
|
||||||
return undefined;
|
return undefined;
|
||||||
@@ -848,9 +848,9 @@ export class SelectionService implements ISelectionService {
|
|||||||
|
|
||||||
// Recurse upwards if the line is wrapped and the word wraps to the above line
|
// Recurse upwards if the line is wrapped and the word wraps to the above line
|
||||||
if (followWrappedLinesAbove) {
|
if (followWrappedLinesAbove) {
|
||||||
if (start === 0 && bufferLine.getCodePoint(0) !== 32 /*' '*/) {
|
if (start === 0 && bufferLine.getCodePoint(0) !== 32 /* ' ' */) {
|
||||||
const previousBufferLine = buffer.lines.get(coords[1] - 1);
|
const previousBufferLine = buffer.lines.get(coords[1] - 1);
|
||||||
if (previousBufferLine && bufferLine.isWrapped && previousBufferLine.getCodePoint(this._bufferService.cols - 1) !== 32 /*' '*/) {
|
if (previousBufferLine && bufferLine.isWrapped && previousBufferLine.getCodePoint(this._bufferService.cols - 1) !== 32 /* ' ' */) {
|
||||||
const previousLineWordPosition = this._getWordAt([this._bufferService.cols - 1, coords[1] - 1], false, true, false);
|
const previousLineWordPosition = this._getWordAt([this._bufferService.cols - 1, coords[1] - 1], false, true, false);
|
||||||
if (previousLineWordPosition) {
|
if (previousLineWordPosition) {
|
||||||
const offset = this._bufferService.cols - previousLineWordPosition.start;
|
const offset = this._bufferService.cols - previousLineWordPosition.start;
|
||||||
@@ -863,9 +863,9 @@ export class SelectionService implements ISelectionService {
|
|||||||
|
|
||||||
// Recurse downwards if the line is wrapped and the word wraps to the next line
|
// Recurse downwards if the line is wrapped and the word wraps to the next line
|
||||||
if (followWrappedLinesBelow) {
|
if (followWrappedLinesBelow) {
|
||||||
if (start + length === this._bufferService.cols && bufferLine.getCodePoint(this._bufferService.cols - 1) !== 32 /*' '*/) {
|
if (start + length === this._bufferService.cols && bufferLine.getCodePoint(this._bufferService.cols - 1) !== 32 /* ' ' */) {
|
||||||
const nextBufferLine = buffer.lines.get(coords[1] + 1);
|
const nextBufferLine = buffer.lines.get(coords[1] + 1);
|
||||||
if (nextBufferLine && nextBufferLine.isWrapped && nextBufferLine.getCodePoint(0) !== 32 /*' '*/) {
|
if (nextBufferLine && nextBufferLine.isWrapped && nextBufferLine.getCodePoint(0) !== 32 /* ' ' */) {
|
||||||
const nextLineWordPosition = this._getWordAt([0, coords[1] + 1], false, false, true);
|
const nextLineWordPosition = this._getWordAt([0, coords[1] + 1], false, false, true);
|
||||||
if (nextLineWordPosition) {
|
if (nextLineWordPosition) {
|
||||||
length += nextLineWordPosition.length;
|
length += nextLineWordPosition.length;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export class MockCharsetService implements ICharsetService {
|
|||||||
serviceBrand: any;
|
serviceBrand: any;
|
||||||
charset: ICharset | undefined;
|
charset: ICharset | undefined;
|
||||||
glevel: number = 0;
|
glevel: number = 0;
|
||||||
charsets: readonly ICharset[] = [];
|
charsets: ReadonlyArray<ICharset> = [];
|
||||||
reset(): void {}
|
reset(): void {}
|
||||||
setgLevel(g: number): void {}
|
setgLevel(g: number): void {}
|
||||||
setgCharset(g: number, charset: ICharset): void {}
|
setgCharset(g: number, charset: ICharset): void {}
|
||||||
@@ -116,7 +116,7 @@ export class MockUnicodeService implements IUnicodeService {
|
|||||||
versions: string[] = [];
|
versions: string[] = [];
|
||||||
activeVersion: string = '';
|
activeVersion: string = '';
|
||||||
onChange: IEvent<string> = new EventEmitter<string>().event;
|
onChange: IEvent<string> = new EventEmitter<string>().event;
|
||||||
wcwidth = (codepoint: number) => this._provider.wcwidth(codepoint);
|
wcwidth = (codepoint: number): number => this._provider.wcwidth(codepoint);
|
||||||
getStringCellWidth(s: string): number {
|
getStringCellWidth(s: string): number {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,7 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { fillFallback, concat } from 'common/TypedArrayUtils';
|
import { fillFallback, concat } from 'common/TypedArrayUtils';
|
||||||
|
|
||||||
type TypedArray = Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray
|
type TypedArray = Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array;
|
||||||
| Int8Array | Int16Array | Int32Array
|
|
||||||
| Float32Array | Float64Array;
|
|
||||||
|
|
||||||
function deepEquals(a: TypedArray, b: TypedArray): void {
|
function deepEquals(a: TypedArray, b: TypedArray): void {
|
||||||
assert.equal(a.length, b.length);
|
assert.equal(a.length, b.length);
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type TypedArray = Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray
|
export type TypedArray = Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array;
|
||||||
| Int8Array | Int16Array | Int32Array
|
|
||||||
| Float32Array | Float64Array;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -246,6 +246,7 @@ CHARSETS['='] = {
|
|||||||
'\\': 'ç',
|
'\\': 'ç',
|
||||||
']': 'ê',
|
']': 'ê',
|
||||||
'^': 'î',
|
'^': 'î',
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
'_': 'è',
|
'_': 'è',
|
||||||
'`': 'ô',
|
'`': 'ô',
|
||||||
'{': 'ä',
|
'{': 'ä',
|
||||||
|
|||||||
@@ -107,16 +107,16 @@ it('wcwidth should match all values from the old implementation', function(): vo
|
|||||||
function isWideBMP(ucs: number): boolean {
|
function isWideBMP(ucs: number): boolean {
|
||||||
return (
|
return (
|
||||||
ucs >= 0x1100 && (
|
ucs >= 0x1100 && (
|
||||||
ucs <= 0x115f || // Hangul Jamo init. consonants
|
ucs <= 0x115f || // Hangul Jamo init. consonants
|
||||||
ucs === 0x2329 ||
|
ucs === 0x2329 ||
|
||||||
ucs === 0x232a ||
|
ucs === 0x232a ||
|
||||||
(ucs >= 0x2e80 && ucs <= 0xa4cf && ucs !== 0x303f) || // CJK..Yi
|
(ucs >= 0x2e80 && ucs <= 0xa4cf && ucs !== 0x303f) || // CJK..Yi
|
||||||
(ucs >= 0xac00 && ucs <= 0xd7a3) || // Hangul Syllables
|
(ucs >= 0xac00 && ucs <= 0xd7a3) || // Hangul Syllables
|
||||||
(ucs >= 0xf900 && ucs <= 0xfaff) || // CJK Compat Ideographs
|
(ucs >= 0xf900 && ucs <= 0xfaff) || // CJK Compat Ideographs
|
||||||
(ucs >= 0xfe10 && ucs <= 0xfe19) || // Vertical forms
|
(ucs >= 0xfe10 && ucs <= 0xfe19) || // Vertical forms
|
||||||
(ucs >= 0xfe30 && ucs <= 0xfe6f) || // CJK Compat Forms
|
(ucs >= 0xfe30 && ucs <= 0xfe6f) || // CJK Compat Forms
|
||||||
(ucs >= 0xff00 && ucs <= 0xff60) || // Fullwidth Forms
|
(ucs >= 0xff00 && ucs <= 0xff60) || // Fullwidth Forms
|
||||||
(ucs >= 0xffe0 && ucs <= 0xffe6)));
|
(ucs >= 0xffe0 && ucs <= 0xffe6)));
|
||||||
}
|
}
|
||||||
function wcwidthHigh(ucs: number): 0 | 1 | 2 {
|
function wcwidthHigh(ucs: number): 0 | 1 | 2 {
|
||||||
if (bisearch(ucs, COMBINING_HIGH)) {
|
if (bisearch(ucs, COMBINING_HIGH)) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { WriteBuffer } from './WriteBuffer';
|
import { WriteBuffer } from './WriteBuffer';
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
declare let Buffer: any;
|
declare let Buffer: any;
|
||||||
|
|
||||||
function toBytes(s: string): Uint8Array {
|
function toBytes(s: string): Uint8Array {
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ const oscPutParser = new MockOscPutParser();
|
|||||||
|
|
||||||
// derived parser with access to internal states
|
// derived parser with access to internal states
|
||||||
class TestEscapeSequenceParser extends EscapeSequenceParser {
|
class TestEscapeSequenceParser extends EscapeSequenceParser {
|
||||||
|
public get transitions(): TransitionTable {
|
||||||
|
return this._transitions;
|
||||||
|
}
|
||||||
public get osc(): string {
|
public get osc(): string {
|
||||||
return (this._oscParser as MockOscPutParser).data;
|
return (this._oscParser as MockOscPutParser).data;
|
||||||
}
|
}
|
||||||
@@ -192,13 +195,13 @@ describe('EscapeSequenceParser', function (): void {
|
|||||||
const parser = testParser;
|
const parser = testParser;
|
||||||
describe('Parser init and methods', function (): void {
|
describe('Parser init and methods', function (): void {
|
||||||
it('constructor', function (): void {
|
it('constructor', function (): void {
|
||||||
let p: EscapeSequenceParser = new EscapeSequenceParser();
|
let p = new TestEscapeSequenceParser();
|
||||||
chai.expect(p.TRANSITIONS).equal(VT500_TRANSITION_TABLE);
|
chai.expect(p.transitions).equal(VT500_TRANSITION_TABLE);
|
||||||
p = new EscapeSequenceParser(VT500_TRANSITION_TABLE);
|
p = new TestEscapeSequenceParser(VT500_TRANSITION_TABLE);
|
||||||
chai.expect(p.TRANSITIONS).equal(VT500_TRANSITION_TABLE);
|
chai.expect(p.transitions).equal(VT500_TRANSITION_TABLE);
|
||||||
const tansitions: TransitionTable = new TransitionTable(10);
|
const tansitions: TransitionTable = new TransitionTable(10);
|
||||||
p = new EscapeSequenceParser(tansitions);
|
p = new TestEscapeSequenceParser(tansitions);
|
||||||
chai.expect(p.TRANSITIONS).equal(tansitions);
|
chai.expect(p.transitions).equal(tansitions);
|
||||||
});
|
});
|
||||||
it('inital states', function (): void {
|
it('inital states', function (): void {
|
||||||
chai.expect(parser.initialState).equal(ParserState.GROUND);
|
chai.expect(parser.initialState).equal(ParserState.GROUND);
|
||||||
@@ -735,7 +738,7 @@ describe('EscapeSequenceParser', function (): void {
|
|||||||
it('state OSC_STRING ignore rules', function (): void {
|
it('state OSC_STRING ignore rules', function (): void {
|
||||||
parser.reset();
|
parser.reset();
|
||||||
const ignored = [
|
const ignored = [
|
||||||
'\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', /*'\x07',*/ '\x08',
|
'\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', /* '\x07', */ '\x08',
|
||||||
'\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', '\x10', '\x11',
|
'\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', '\x10', '\x11',
|
||||||
'\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x19', '\x1c', '\x1d', '\x1e', '\x1f'];
|
'\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x19', '\x1c', '\x1d', '\x1e', '\x1f'];
|
||||||
for (let i = 0; i < ignored.length; ++i) {
|
for (let i = 0; i < ignored.length; ++i) {
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ export const VT500_TRANSITION_TABLE = (function (): TransitionTable {
|
|||||||
// range macro for byte
|
// range macro for byte
|
||||||
const BYTE_VALUES = 256;
|
const BYTE_VALUES = 256;
|
||||||
const blueprint = Array.apply(null, Array(BYTE_VALUES)).map((unused: any, i: number) => i);
|
const blueprint = Array.apply(null, Array(BYTE_VALUES)).map((unused: any, i: number) => i);
|
||||||
const r = (start: number, end: number) => blueprint.slice(start, end);
|
const r = (start: number, end: number): number[] => blueprint.slice(start, end);
|
||||||
|
|
||||||
// Default definitions.
|
// Default definitions.
|
||||||
const PRINTABLES = r(0x20, 0x7f); // 0x20 (SP) included, 0x7F (DEL) excluded
|
const PRINTABLES = r(0x20, 0x7f); // 0x20 (SP) included, 0x7F (DEL) excluded
|
||||||
@@ -253,7 +253,9 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
|
|||||||
protected _escHandlerFb: EscFallbackHandlerType;
|
protected _escHandlerFb: EscFallbackHandlerType;
|
||||||
protected _errorHandlerFb: (state: IParsingState) => IParsingState;
|
protected _errorHandlerFb: (state: IParsingState) => IParsingState;
|
||||||
|
|
||||||
constructor(readonly TRANSITIONS: TransitionTable = VT500_TRANSITION_TABLE) {
|
constructor(
|
||||||
|
protected readonly _transitions: TransitionTable = VT500_TRANSITION_TABLE
|
||||||
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.initialState = ParserState.GROUND;
|
this.initialState = ParserState.GROUND;
|
||||||
@@ -471,7 +473,7 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
|
|||||||
const dcs = this._dcsParser;
|
const dcs = this._dcsParser;
|
||||||
let collect = this._collect;
|
let collect = this._collect;
|
||||||
const params = this._params;
|
const params = this._params;
|
||||||
const table: Uint8Array = this.TRANSITIONS.table;
|
const table: Uint8Array = this._transitions.table;
|
||||||
|
|
||||||
// process input string
|
// process input string
|
||||||
for (let i = 0; i < length; ++i) {
|
for (let i = 0; i < length; ++i) {
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import { IBufferService, ICoreService, ICoreMouseService } from 'common/services
|
|||||||
import { EventEmitter, IEvent } from 'common/EventEmitter';
|
import { EventEmitter, IEvent } from 'common/EventEmitter';
|
||||||
import { ICoreMouseProtocol, ICoreMouseEvent, CoreMouseEncoding, CoreMouseEventType, CoreMouseButton, CoreMouseAction } from 'common/Types';
|
import { ICoreMouseProtocol, ICoreMouseEvent, CoreMouseEncoding, CoreMouseEventType, CoreMouseButton, CoreMouseAction } from 'common/Types';
|
||||||
|
|
||||||
|
// Disable naming convention as this file uses non-standard naming and it might be dangerous to change it
|
||||||
|
/* eslint-disable @typescript-eslint/naming-convention */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supported default protocols.
|
* Supported default protocols.
|
||||||
*/
|
*/
|
||||||
@@ -284,11 +287,11 @@ export class CoreMouseService implements ICoreMouseService {
|
|||||||
|
|
||||||
public explainEvents(events: CoreMouseEventType): {[event: string]: boolean} {
|
public explainEvents(events: CoreMouseEventType): {[event: string]: boolean} {
|
||||||
return {
|
return {
|
||||||
DOWN: !!(events & CoreMouseEventType.DOWN),
|
down: !!(events & CoreMouseEventType.DOWN),
|
||||||
UP: !!(events & CoreMouseEventType.UP),
|
up: !!(events & CoreMouseEventType.UP),
|
||||||
DRAG: !!(events & CoreMouseEventType.DRAG),
|
drag: !!(events & CoreMouseEventType.DRAG),
|
||||||
MOVE: !!(events & CoreMouseEventType.MOVE),
|
move: !!(events & CoreMouseEventType.MOVE),
|
||||||
WHEEL: !!(events & CoreMouseEventType.WHEEL)
|
wheel: !!(events & CoreMouseEventType.WHEEL)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export class InstantiationService implements IInstantiationService {
|
|||||||
return this._services.get(id);
|
return this._services.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public createInstance<T>(ctor: any, ...args: any[]): any {
|
public createInstance<T>(ctor: any, ...args: any[]): T {
|
||||||
const serviceDependencies = getServiceDependencies(ctor).sort((a, b) => a.index - b.index);
|
const serviceDependencies = getServiceDependencies(ctor).sort((a, b) => a.index - b.index);
|
||||||
|
|
||||||
const serviceArgs: any[] = [];
|
const serviceArgs: any[] = [];
|
||||||
@@ -76,6 +76,6 @@ export class InstantiationService implements IInstantiationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// now create the instance
|
// now create the instance
|
||||||
return <T>new ctor(...[...args, ...serviceArgs]);
|
return new ctor(...[...args, ...serviceArgs]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export function createDecorator<T>(id: string): IServiceIdentifier<T> {
|
|||||||
return serviceRegistry.get(id)!;
|
return serviceRegistry.get(id)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
const decorator = <any>function (target: Function, key: string, index: number): any {
|
const decorator: any = function (target: Function, key: string, index: number): any {
|
||||||
if (arguments.length !== 3) {
|
if (arguments.length !== 3) {
|
||||||
throw new Error('@IServiceName-decorator can only be used to decorate a parameter');
|
throw new Error('@IServiceName-decorator can only be used to decorate a parameter');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ export interface ICoreService {
|
|||||||
* Triggers the onBinary event in the public API.
|
* Triggers the onBinary event in the public API.
|
||||||
* @param data The data that is being emitted.
|
* @param data The data that is being emitted.
|
||||||
*/
|
*/
|
||||||
triggerBinaryEvent(data: string): void;
|
triggerBinaryEvent(data: string): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ICharsetService = createDecorator<ICharsetService>('CharsetService');
|
export const ICharsetService = createDecorator<ICharsetService>('CharsetService');
|
||||||
@@ -104,7 +104,7 @@ export interface ICharsetService {
|
|||||||
* Set the G level of the terminal.
|
* Set the G level of the terminal.
|
||||||
* @param g
|
* @param g
|
||||||
*/
|
*/
|
||||||
setgLevel(g: number): void;
|
setgLevel(g: number): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the charset for the given G level of the terminal.
|
* Set the charset for the given G level of the terminal.
|
||||||
@@ -133,39 +133,39 @@ export interface IServiceIdentifier<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IConstructorSignature0<T> {
|
export interface IConstructorSignature0<T> {
|
||||||
new(...services: { serviceBrand: any; }[]): T;
|
new(...services: { serviceBrand: any }[]): T;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IConstructorSignature1<A1, T> {
|
export interface IConstructorSignature1<A1, T> {
|
||||||
new(first: A1, ...services: { serviceBrand: any; }[]): T;
|
new(first: A1, ...services: { serviceBrand: any }[]): T;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IConstructorSignature2<A1, A2, T> {
|
export interface IConstructorSignature2<A1, A2, T> {
|
||||||
new(first: A1, second: A2, ...services: { serviceBrand: any; }[]): T;
|
new(first: A1, second: A2, ...services: { serviceBrand: any }[]): T;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IConstructorSignature3<A1, A2, A3, T> {
|
export interface IConstructorSignature3<A1, A2, A3, T> {
|
||||||
new(first: A1, second: A2, third: A3, ...services: { serviceBrand: any; }[]): T;
|
new(first: A1, second: A2, third: A3, ...services: { serviceBrand: any }[]): T;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IConstructorSignature4<A1, A2, A3, A4, T> {
|
export interface IConstructorSignature4<A1, A2, A3, A4, T> {
|
||||||
new(first: A1, second: A2, third: A3, fourth: A4, ...services: { serviceBrand: any; }[]): T;
|
new(first: A1, second: A2, third: A3, fourth: A4, ...services: { serviceBrand: any }[]): T;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IConstructorSignature5<A1, A2, A3, A4, A5, T> {
|
export interface IConstructorSignature5<A1, A2, A3, A4, A5, T> {
|
||||||
new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, ...services: { serviceBrand: any; }[]): T;
|
new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, ...services: { serviceBrand: any }[]): T;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IConstructorSignature6<A1, A2, A3, A4, A5, A6, T> {
|
export interface IConstructorSignature6<A1, A2, A3, A4, A5, A6, T> {
|
||||||
new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, ...services: { serviceBrand: any; }[]): T;
|
new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, ...services: { serviceBrand: any }[]): T;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IConstructorSignature7<A1, A2, A3, A4, A5, A6, A7, T> {
|
export interface IConstructorSignature7<A1, A2, A3, A4, A5, A6, A7, T> {
|
||||||
new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, seventh: A7, ...services: { serviceBrand: any; }[]): T;
|
new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, seventh: A7, ...services: { serviceBrand: any }[]): T;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IConstructorSignature8<A1, A2, A3, A4, A5, A6, A7, A8, T> {
|
export interface IConstructorSignature8<A1, A2, A3, A4, A5, A6, A7, A8, T> {
|
||||||
new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, seventh: A7, eigth: A8, ...services: { serviceBrand: any; }[]): T;
|
new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, seventh: A7, eigth: A8, ...services: { serviceBrand: any }[]): T;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const IInstantiationService = createDecorator<IInstantiationService>('InstantiationService');
|
export const IInstantiationService = createDecorator<IInstantiationService>('InstantiationService');
|
||||||
@@ -213,7 +213,7 @@ export type RendererType = 'dom' | 'canvas';
|
|||||||
export interface IPartialTerminalOptions {
|
export interface IPartialTerminalOptions {
|
||||||
allowTransparency?: boolean;
|
allowTransparency?: boolean;
|
||||||
bellSound?: string;
|
bellSound?: string;
|
||||||
bellStyle?: 'none' /*| 'visual'*/ | 'sound' /*| 'both'*/;
|
bellStyle?: 'none' | 'sound' /* | 'visual' | 'both' */;
|
||||||
cols?: number;
|
cols?: number;
|
||||||
cursorBlink?: boolean;
|
cursorBlink?: boolean;
|
||||||
cursorStyle?: 'block' | 'underline' | 'bar';
|
cursorStyle?: 'block' | 'underline' | 'bar';
|
||||||
@@ -247,7 +247,7 @@ export interface IPartialTerminalOptions {
|
|||||||
export interface ITerminalOptions {
|
export interface ITerminalOptions {
|
||||||
allowTransparency: boolean;
|
allowTransparency: boolean;
|
||||||
bellSound: string;
|
bellSound: string;
|
||||||
bellStyle: 'none' /*| 'visual'*/ | 'sound' /*| 'both'*/;
|
bellStyle: 'none' | 'sound' /* | 'visual' | 'both' */;
|
||||||
cols: number;
|
cols: number;
|
||||||
cursorBlink: boolean;
|
cursorBlink: boolean;
|
||||||
cursorStyle: 'block' | 'underline' | 'bar';
|
cursorStyle: 'block' | 'underline' | 'bar';
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ describe('InputHandler Integration Tests', function(): void {
|
|||||||
});
|
});
|
||||||
(isChromium ? it : it.skip)('Pm = 2004, Set bracketed paste mode', async function(): Promise<any> {
|
(isChromium ? it : it.skip)('Pm = 2004, Set bracketed paste mode', async function(): Promise<any> {
|
||||||
await pollFor(page, () => simulatePaste('foo'), 'foo');
|
await pollFor(page, () => simulatePaste('foo'), 'foo');
|
||||||
await page.evaluate(`window.term.write('\x1b[?2004h')`)
|
await page.evaluate(`window.term.write('\x1b[?2004h')`);
|
||||||
await pollFor(page, () => simulatePaste('bar'), '\x1b[200~bar\x1b[201~');
|
await pollFor(page, () => simulatePaste('bar'), '\x1b[200~bar\x1b[201~');
|
||||||
await page.evaluate(`window.term.write('\x1b[?2004l')`);
|
await page.evaluate(`window.term.write('\x1b[?2004l')`);
|
||||||
await pollFor(page, () => simulatePaste('baz'), 'baz');
|
await pollFor(page, () => simulatePaste('baz'), 'baz');
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const cols = 260;
|
|||||||
const rows = 50;
|
const rows = 50;
|
||||||
|
|
||||||
// Wheel events are hacked using private API that is only available in Chromium
|
// Wheel events are hacked using private API that is only available in Chromium
|
||||||
const isChromium = false
|
const isChromium = false;
|
||||||
|
|
||||||
// for some reason shift gets not caught by selection manager on macos
|
// for some reason shift gets not caught by selection manager on macos
|
||||||
const noShift = process.platform === 'darwin' ? false : true;
|
const noShift = process.platform === 'darwin' ? false : true;
|
||||||
@@ -169,7 +169,7 @@ function evalButtonCode(code: number): any {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// parse a single mouse report
|
// parse a single mouse report
|
||||||
function parseReport(encoding: string, msg: number[]): { state: any; row: number; col: number; } | string {
|
function parseReport(encoding: string, msg: number[]): { state: any, row: number, col: number } | string {
|
||||||
let sReport: string;
|
let sReport: string;
|
||||||
let buttonCode: number;
|
let buttonCode: number;
|
||||||
let row: number;
|
let row: number;
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ function toUtf32(s: string): Uint32Array {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class DcsHandler implements IDcsHandler {
|
class DcsHandler implements IDcsHandler {
|
||||||
hook(params: IParams) : void {}
|
hook(params: IParams): void {}
|
||||||
put(data: Uint32Array, start: number, end: number) : void {}
|
put(data: Uint32Array, start: number, end: number): void {}
|
||||||
unhook() :void {}
|
unhook(): void {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
perfContext('Parser throughput - 50MB data', () => {
|
perfContext('Parser throughput - 50MB data', () => {
|
||||||
let parsed: Uint32Array;
|
let parsed: Uint32Array;
|
||||||
let parser: EscapeSequenceParser;
|
let parser: EscapeSequenceParser;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
parser = new EscapeSequenceParser();
|
parser = new EscapeSequenceParser();
|
||||||
parser.setPrintHandler((data, start, end) => {});
|
parser.setPrintHandler((data, start, end) => {});
|
||||||
|
|||||||
-110
@@ -1,110 +0,0 @@
|
|||||||
{
|
|
||||||
"rulesDirectory": [
|
|
||||||
"tslint-consistent-codestyle"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"array-type": [
|
|
||||||
true,
|
|
||||||
"array"
|
|
||||||
],
|
|
||||||
"class-name": true,
|
|
||||||
"comment-format": [
|
|
||||||
true,
|
|
||||||
"check-space"
|
|
||||||
],
|
|
||||||
"curly": [
|
|
||||||
true,
|
|
||||||
"ignore-same-line"
|
|
||||||
],
|
|
||||||
"indent": [
|
|
||||||
true,
|
|
||||||
"spaces"
|
|
||||||
],
|
|
||||||
"import-blacklist": [
|
|
||||||
true,
|
|
||||||
[".*\\/out\\/.*"]
|
|
||||||
],
|
|
||||||
"interface-name": [
|
|
||||||
true,
|
|
||||||
"always-prefix"
|
|
||||||
],
|
|
||||||
"interface-over-type-literal": true,
|
|
||||||
"typedef": [
|
|
||||||
true,
|
|
||||||
"call-signature",
|
|
||||||
"parameter"
|
|
||||||
],
|
|
||||||
"eofline": true,
|
|
||||||
"new-parens": true,
|
|
||||||
"no-duplicate-imports": true,
|
|
||||||
"no-eval": true,
|
|
||||||
"no-internal-module": true,
|
|
||||||
"no-trailing-whitespace": true,
|
|
||||||
"one-variable-per-declaration": true,
|
|
||||||
"no-unsafe-finally": true,
|
|
||||||
"no-var-keyword": true,
|
|
||||||
"prefer-const": true,
|
|
||||||
"quotemark": [
|
|
||||||
true,
|
|
||||||
"single"
|
|
||||||
],
|
|
||||||
"semicolon": [
|
|
||||||
true,
|
|
||||||
"always"
|
|
||||||
],
|
|
||||||
"trailing-comma": [
|
|
||||||
true,
|
|
||||||
{
|
|
||||||
"multiline": {
|
|
||||||
"objects": "never",
|
|
||||||
"arrays": "never",
|
|
||||||
"functions": "never",
|
|
||||||
"typeLiterals": "ignore"
|
|
||||||
},
|
|
||||||
"esSpecCompliant": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"triple-equals": true,
|
|
||||||
"typedef-whitespace": [
|
|
||||||
true,
|
|
||||||
{
|
|
||||||
"call-signature": "nospace",
|
|
||||||
"index-signature": "nospace",
|
|
||||||
"parameter": "nospace",
|
|
||||||
"property-declaration": "nospace",
|
|
||||||
"variable-declaration": "nospace"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"whitespace": [
|
|
||||||
true,
|
|
||||||
"check-branch",
|
|
||||||
"check-decl",
|
|
||||||
"check-module",
|
|
||||||
"check-operator",
|
|
||||||
"check-rest-spread",
|
|
||||||
"check-separator",
|
|
||||||
"check-type",
|
|
||||||
"check-type-operator",
|
|
||||||
"check-preblock"
|
|
||||||
],
|
|
||||||
|
|
||||||
"naming-convention": [
|
|
||||||
true,
|
|
||||||
{"type": "default", "format": "camelCase", "leadingUnderscore": "forbid"},
|
|
||||||
{"type": "type", "format": "PascalCase"},
|
|
||||||
{"type": "class", "format": "PascalCase"},
|
|
||||||
{"type": "property", "modifiers": ["const"], "format": ["camelCase", "UPPER_CASE"]},
|
|
||||||
{"type": "member", "modifiers": ["protected"], "format": "camelCase", "leadingUnderscore": "require"},
|
|
||||||
{"type": "member", "modifiers": ["private"], "format": "camelCase", "leadingUnderscore": "require"},
|
|
||||||
{"type": "variable", "modifiers": ["const"], "format": ["camelCase", "UPPER_CASE"]},
|
|
||||||
{"type": "variable", "modifiers": ["const", "export"], "filter": "^I.+Service$", "format": "PascalCase", "prefix": "I"},
|
|
||||||
{"type": "interface", "prefix": "I"}
|
|
||||||
],
|
|
||||||
"no-else-after-return": {
|
|
||||||
"options": "allow-else-if"
|
|
||||||
},
|
|
||||||
"prefer-const-enum": [
|
|
||||||
true
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
+1
-1
@@ -45,7 +45,7 @@ declare module 'xterm' {
|
|||||||
/**
|
/**
|
||||||
* The type of the bell notification the terminal will use.
|
* The type of the bell notification the terminal will use.
|
||||||
*/
|
*/
|
||||||
bellStyle?: 'none' /*| 'visual'*/ | 'sound' /*| 'both'*/;
|
bellStyle?: 'none' | 'sound';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When enabled the cursor will be set to the beginning of the next line
|
* When enabled the cursor will be set to the beginning of the next line
|
||||||
|
|||||||
Reference in New Issue
Block a user