Merge branch 'master' into reverse_wraparound
This commit is contained in:
@@ -13,7 +13,7 @@ import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEventType, ICharset } from
|
||||
import { UnicodeV6 } from 'common/input/UnicodeV6';
|
||||
|
||||
export class MockBufferService implements IBufferService {
|
||||
serviceBrand: any;
|
||||
public serviceBrand: any;
|
||||
public get buffer(): IBuffer { return this.buffers.active; }
|
||||
public buffers: IBufferSet = {} as any;
|
||||
constructor(
|
||||
@@ -23,102 +23,103 @@ export class MockBufferService implements IBufferService {
|
||||
) {
|
||||
this.buffers = new BufferSet(optionsService, this);
|
||||
}
|
||||
resize(cols: number, rows: number): void {
|
||||
public resize(cols: number, rows: number): void {
|
||||
this.cols = cols;
|
||||
this.rows = rows;
|
||||
}
|
||||
reset(): void {}
|
||||
public reset(): void {}
|
||||
}
|
||||
|
||||
export class MockCoreMouseService implements ICoreMouseService {
|
||||
activeEncoding: string = '';
|
||||
activeProtocol: string = '';
|
||||
addEncoding(name: string): void {}
|
||||
addProtocol(name: string): void {}
|
||||
reset(): void {}
|
||||
triggerMouseEvent(event: ICoreMouseEvent): boolean { return false; }
|
||||
onProtocolChange: IEvent<CoreMouseEventType> = new EventEmitter<CoreMouseEventType>().event;
|
||||
explainEvents(events: CoreMouseEventType): {[event: string]: boolean} {
|
||||
public activeEncoding: string = '';
|
||||
public activeProtocol: string = '';
|
||||
public addEncoding(name: string): void {}
|
||||
public addProtocol(name: string): void {}
|
||||
public reset(): void {}
|
||||
public triggerMouseEvent(event: ICoreMouseEvent): boolean { return false; }
|
||||
public onProtocolChange: IEvent<CoreMouseEventType> = new EventEmitter<CoreMouseEventType>().event;
|
||||
public explainEvents(events: CoreMouseEventType): {[event: string]: boolean} {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
export class MockCharsetService implements ICharsetService {
|
||||
serviceBrand: any;
|
||||
charset: ICharset | undefined;
|
||||
glevel: number = 0;
|
||||
charsets: readonly ICharset[] = [];
|
||||
reset(): void {}
|
||||
setgLevel(g: number): void {}
|
||||
setgCharset(g: number, charset: ICharset): void {}
|
||||
public serviceBrand: any;
|
||||
public charset: ICharset | undefined;
|
||||
public glevel: number = 0;
|
||||
public charsets: ReadonlyArray<ICharset> = [];
|
||||
public reset(): void {}
|
||||
public setgLevel(g: number): void {}
|
||||
public setgCharset(g: number, charset: ICharset): void {}
|
||||
}
|
||||
|
||||
export class MockCoreService implements ICoreService {
|
||||
serviceBrand: any;
|
||||
isCursorInitialized: boolean = false;
|
||||
isCursorHidden: boolean = false;
|
||||
isFocused: boolean = false;
|
||||
decPrivateModes: IDecPrivateModes = {
|
||||
public serviceBrand: any;
|
||||
public isCursorInitialized: boolean = false;
|
||||
public isCursorHidden: boolean = false;
|
||||
public isFocused: boolean = false;
|
||||
public decPrivateModes: IDecPrivateModes = {
|
||||
applicationCursorKeys: false,
|
||||
applicationKeypad: false,
|
||||
origin: false,
|
||||
reverseWraparound: false,
|
||||
wraparound: true
|
||||
};
|
||||
onData: IEvent<string> = new EventEmitter<string>().event;
|
||||
onUserInput: IEvent<void> = new EventEmitter<void>().event;
|
||||
onBinary: IEvent<string> = new EventEmitter<string>().event;
|
||||
reset(): void {}
|
||||
triggerDataEvent(data: string, wasUserInput?: boolean): void {}
|
||||
triggerBinaryEvent(data: string): void {}
|
||||
public onData: IEvent<string> = new EventEmitter<string>().event;
|
||||
public onUserInput: IEvent<void> = new EventEmitter<void>().event;
|
||||
public onBinary: IEvent<string> = new EventEmitter<string>().event;
|
||||
public reset(): void {}
|
||||
public triggerDataEvent(data: string, wasUserInput?: boolean): void {}
|
||||
public triggerBinaryEvent(data: string): void {}
|
||||
}
|
||||
|
||||
export class MockDirtyRowService implements IDirtyRowService {
|
||||
serviceBrand: any;
|
||||
start: number = 0;
|
||||
end: number = 0;
|
||||
clearRange(): void {}
|
||||
markDirty(y: number): void {}
|
||||
markRangeDirty(y1: number, y2: number): void {}
|
||||
markAllDirty(): void {}
|
||||
public serviceBrand: any;
|
||||
public start: number = 0;
|
||||
public end: number = 0;
|
||||
public clearRange(): void {}
|
||||
public markDirty(y: number): void {}
|
||||
public markRangeDirty(y1: number, y2: number): void {}
|
||||
public markAllDirty(): void {}
|
||||
}
|
||||
|
||||
export class MockLogService implements ILogService {
|
||||
serviceBrand: any;
|
||||
debug(message: any, ...optionalParams: any[]): void {}
|
||||
info(message: any, ...optionalParams: any[]): void {}
|
||||
warn(message: any, ...optionalParams: any[]): void {}
|
||||
error(message: any, ...optionalParams: any[]): void {}
|
||||
public serviceBrand: any;
|
||||
public debug(message: any, ...optionalParams: any[]): void {}
|
||||
public info(message: any, ...optionalParams: any[]): void {}
|
||||
public warn(message: any, ...optionalParams: any[]): void {}
|
||||
public error(message: any, ...optionalParams: any[]): void {}
|
||||
}
|
||||
|
||||
export class MockOptionsService implements IOptionsService {
|
||||
serviceBrand: any;
|
||||
options: ITerminalOptions = clone(DEFAULT_OPTIONS);
|
||||
onOptionChange: IEvent<string> = new EventEmitter<string>().event;
|
||||
public serviceBrand: any;
|
||||
public options: ITerminalOptions = clone(DEFAULT_OPTIONS);
|
||||
public onOptionChange: IEvent<string> = new EventEmitter<string>().event;
|
||||
constructor(testOptions?: IPartialTerminalOptions) {
|
||||
if (testOptions) {
|
||||
Object.keys(testOptions).forEach(key => this.options[key] = (<any>testOptions)[key]);
|
||||
}
|
||||
}
|
||||
setOption<T>(key: string, value: T): void {
|
||||
public setOption<T>(key: string, value: T): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
getOption<T>(key: string): T {
|
||||
public getOption<T>(key: string): T {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
// defaults to V6 always to keep tests passing
|
||||
export class MockUnicodeService implements IUnicodeService {
|
||||
public serviceBrand: any;
|
||||
private _provider = new UnicodeV6();
|
||||
register(provider: IUnicodeVersionProvider): void {
|
||||
public register(provider: IUnicodeVersionProvider): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
versions: string[] = [];
|
||||
activeVersion: string = '';
|
||||
onChange: IEvent<string> = new EventEmitter<string>().event;
|
||||
wcwidth = (codepoint: number) => this._provider.wcwidth(codepoint);
|
||||
getStringCellWidth(s: string): number {
|
||||
public versions: string[] = [];
|
||||
public activeVersion: string = '';
|
||||
public onChange: IEvent<string> = new EventEmitter<string>().event;
|
||||
public wcwidth = (codepoint: number): number => this._provider.wcwidth(codepoint);
|
||||
public getStringCellWidth(s: string): number {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
import { assert } from 'chai';
|
||||
import { fillFallback, concat } from 'common/TypedArrayUtils';
|
||||
|
||||
type TypedArray = Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray
|
||||
| Int8Array | Int16Array | Int32Array
|
||||
| Float32Array | Float64Array;
|
||||
type TypedArray = Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array;
|
||||
|
||||
function deepEquals(a: TypedArray, b: TypedArray): void {
|
||||
assert.equal(a.length, b.length);
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
export type TypedArray = Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray
|
||||
| Int8Array | Int16Array | Int32Array
|
||||
| Float32Array | Float64Array;
|
||||
export type TypedArray = Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,14 +7,15 @@ import { IAttributeData, IColorRGB } from 'common/Types';
|
||||
import { Attributes, FgFlags, BgFlags } from 'common/buffer/Constants';
|
||||
|
||||
export class AttributeData implements IAttributeData {
|
||||
static toColorRGB(value: number): IColorRGB {
|
||||
public static toColorRGB(value: number): IColorRGB {
|
||||
return [
|
||||
value >>> Attributes.RED_SHIFT & 255,
|
||||
value >>> Attributes.GREEN_SHIFT & 255,
|
||||
value & 255
|
||||
];
|
||||
}
|
||||
static fromColorRGB(value: IColorRGB): number {
|
||||
|
||||
public static fromColorRGB(value: IColorRGB): number {
|
||||
return (value[0] & 255) << Attributes.RED_SHIFT | (value[1] & 255) << Attributes.GREEN_SHIFT | value[2] & 255;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ export class BufferSet implements IBufferSet {
|
||||
* @param _terminal - The terminal the BufferSet will belong to
|
||||
*/
|
||||
constructor(
|
||||
readonly optionsService: IOptionsService,
|
||||
readonly bufferService: IBufferService
|
||||
optionsService: IOptionsService,
|
||||
bufferService: IBufferService
|
||||
) {
|
||||
this._normal = new Buffer(true, optionsService, bufferService);
|
||||
this._normal.fillViewportRows();
|
||||
|
||||
@@ -246,6 +246,7 @@ CHARSETS['='] = {
|
||||
'\\': 'ç',
|
||||
']': 'ê',
|
||||
'^': 'î',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
'_': 'è',
|
||||
'`': 'ô',
|
||||
'{': 'ä',
|
||||
|
||||
@@ -86,6 +86,12 @@ describe('Keyboard', () => {
|
||||
it('should return \\x1b[3;3~ for alt+delete', () => {
|
||||
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 46 }).key, '\x1b[3;3~');
|
||||
});
|
||||
it('should return \\x1b\\r for alt+enter', () => {
|
||||
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 13 }).key, '\x1b\r');
|
||||
});
|
||||
it('should return \\x1b\\x1b for alt+esc', () => {
|
||||
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 27 }).key, '\x1b\x1b');
|
||||
});
|
||||
it('should return \\x1b[5D for ctrl+left', () => {
|
||||
assert.equal(testEvaluateKeyboardEvent({ ctrlKey: true, keyCode: 37 }).key, '\x1b[1;5D'); // CSI 5 D
|
||||
});
|
||||
@@ -141,6 +147,10 @@ describe('Keyboard', () => {
|
||||
it('should return \\x1ba for alt+a', () => {
|
||||
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 65 }, { isMac: true, macOptionIsMeta: true }).key, '\x1ba');
|
||||
});
|
||||
|
||||
it('should return \\x1b\\x1b for alt+enter', () => {
|
||||
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 13 }, { isMac: true, macOptionIsMeta: true }).key, '\x1b\r');
|
||||
});
|
||||
});
|
||||
|
||||
it('should return \\x1b[5A for alt+up', () => {
|
||||
|
||||
@@ -103,12 +103,15 @@ export function evaluateKeyboardEvent(
|
||||
break;
|
||||
case 13:
|
||||
// return/enter
|
||||
result.key = C0.CR;
|
||||
result.key = ev.altKey ? C0.ESC + C0.CR : C0.CR;
|
||||
result.cancel = true;
|
||||
break;
|
||||
case 27:
|
||||
// escape
|
||||
result.key = C0.ESC;
|
||||
if (ev.altKey) {
|
||||
result.key = C0.ESC + C0.ESC;
|
||||
}
|
||||
result.cancel = true;
|
||||
break;
|
||||
case 37:
|
||||
|
||||
@@ -64,7 +64,7 @@ export class StringToUtf32 {
|
||||
* the provided input data does not exceed the size of `target`.
|
||||
* Returns the number of written codepoints in `target`.
|
||||
*/
|
||||
decode(input: string, target: Uint32Array): number {
|
||||
public decode(input: string, target: Uint32Array): number {
|
||||
const length = input.length;
|
||||
|
||||
if (!length) {
|
||||
@@ -132,7 +132,7 @@ export class Utf8ToUtf32 {
|
||||
* the provided data chunk does not exceed the size of `target`.
|
||||
* Returns the number of written codepoints in `target`.
|
||||
*/
|
||||
decode(input: Uint8Array, target: Uint32Array): number {
|
||||
public decode(input: Uint8Array, target: Uint32Array): number {
|
||||
const length = input.length;
|
||||
|
||||
if (!length) {
|
||||
|
||||
@@ -107,16 +107,16 @@ it('wcwidth should match all values from the old implementation', function(): vo
|
||||
function isWideBMP(ucs: number): boolean {
|
||||
return (
|
||||
ucs >= 0x1100 && (
|
||||
ucs <= 0x115f || // Hangul Jamo init. consonants
|
||||
ucs === 0x2329 ||
|
||||
ucs === 0x232a ||
|
||||
(ucs >= 0x2e80 && ucs <= 0xa4cf && ucs !== 0x303f) || // CJK..Yi
|
||||
(ucs >= 0xac00 && ucs <= 0xd7a3) || // Hangul Syllables
|
||||
(ucs >= 0xf900 && ucs <= 0xfaff) || // CJK Compat Ideographs
|
||||
(ucs >= 0xfe10 && ucs <= 0xfe19) || // Vertical forms
|
||||
(ucs >= 0xfe30 && ucs <= 0xfe6f) || // CJK Compat Forms
|
||||
(ucs >= 0xff00 && ucs <= 0xff60) || // Fullwidth Forms
|
||||
(ucs >= 0xffe0 && ucs <= 0xffe6)));
|
||||
ucs <= 0x115f || // Hangul Jamo init. consonants
|
||||
ucs === 0x2329 ||
|
||||
ucs === 0x232a ||
|
||||
(ucs >= 0x2e80 && ucs <= 0xa4cf && ucs !== 0x303f) || // CJK..Yi
|
||||
(ucs >= 0xac00 && ucs <= 0xd7a3) || // Hangul Syllables
|
||||
(ucs >= 0xf900 && ucs <= 0xfaff) || // CJK Compat Ideographs
|
||||
(ucs >= 0xfe10 && ucs <= 0xfe19) || // Vertical forms
|
||||
(ucs >= 0xfe30 && ucs <= 0xfe6f) || // CJK Compat Forms
|
||||
(ucs >= 0xff00 && ucs <= 0xff60) || // Fullwidth Forms
|
||||
(ucs >= 0xffe0 && ucs <= 0xffe6)));
|
||||
}
|
||||
function wcwidthHigh(ucs: number): 0 | 1 | 2 {
|
||||
if (bisearch(ucs, COMBINING_HIGH)) {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import { assert } from 'chai';
|
||||
import { WriteBuffer } from './WriteBuffer';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
declare let Buffer: any;
|
||||
|
||||
function toBytes(s: string): Uint8Array {
|
||||
|
||||
@@ -55,13 +55,13 @@ function identifier(id: IFunctionIdentifier): number {
|
||||
|
||||
class TestHandler implements IDcsHandler {
|
||||
constructor(public output: any[], public msg: string, public returnFalse: boolean = false) {}
|
||||
hook(params: IParams): void {
|
||||
public hook(params: IParams): void {
|
||||
this.output.push([this.msg, 'HOOK', params.toArray()]);
|
||||
}
|
||||
put(data: Uint32Array, start: number, end: number): void {
|
||||
public put(data: Uint32Array, start: number, end: number): void {
|
||||
this.output.push([this.msg, 'PUT', utf32ToString(data, start, end)]);
|
||||
}
|
||||
unhook(success: boolean): void | boolean {
|
||||
public unhook(success: boolean): void | boolean {
|
||||
this.output.push([this.msg, 'UNHOOK', success]);
|
||||
if (this.returnFalse) {
|
||||
return false;
|
||||
|
||||
@@ -41,16 +41,16 @@ class MockOscPutParser implements IOscParser {
|
||||
this._fallback(id, 'END', this.data.slice(this.data.indexOf(';') + 1));
|
||||
}
|
||||
}
|
||||
addHandler(ident: number, handler: IOscHandler): IDisposable {
|
||||
public addHandler(ident: number, handler: IOscHandler): IDisposable {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
setHandler(ident: number, handler: IOscHandler): void {
|
||||
public setHandler(ident: number, handler: IOscHandler): void {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
clearHandler(ident: number): void {
|
||||
public clearHandler(ident: number): void {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
setHandlerFallback(handler: OscFallbackHandlerType): void {
|
||||
public setHandlerFallback(handler: OscFallbackHandlerType): void {
|
||||
this._fallback = handler;
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,9 @@ const oscPutParser = new MockOscPutParser();
|
||||
|
||||
// derived parser with access to internal states
|
||||
class TestEscapeSequenceParser extends EscapeSequenceParser {
|
||||
public get transitions(): TransitionTable {
|
||||
return this._transitions;
|
||||
}
|
||||
public get osc(): string {
|
||||
return (this._oscParser as MockOscPutParser).data;
|
||||
}
|
||||
@@ -192,13 +195,13 @@ describe('EscapeSequenceParser', function (): void {
|
||||
const parser = testParser;
|
||||
describe('Parser init and methods', function (): void {
|
||||
it('constructor', function (): void {
|
||||
let p: EscapeSequenceParser = new EscapeSequenceParser();
|
||||
chai.expect(p.TRANSITIONS).equal(VT500_TRANSITION_TABLE);
|
||||
p = new EscapeSequenceParser(VT500_TRANSITION_TABLE);
|
||||
chai.expect(p.TRANSITIONS).equal(VT500_TRANSITION_TABLE);
|
||||
let p = new TestEscapeSequenceParser();
|
||||
chai.expect(p.transitions).equal(VT500_TRANSITION_TABLE);
|
||||
p = new TestEscapeSequenceParser(VT500_TRANSITION_TABLE);
|
||||
chai.expect(p.transitions).equal(VT500_TRANSITION_TABLE);
|
||||
const tansitions: TransitionTable = new TransitionTable(10);
|
||||
p = new EscapeSequenceParser(tansitions);
|
||||
chai.expect(p.TRANSITIONS).equal(tansitions);
|
||||
p = new TestEscapeSequenceParser(tansitions);
|
||||
chai.expect(p.transitions).equal(tansitions);
|
||||
});
|
||||
it('inital states', function (): void {
|
||||
chai.expect(parser.initialState).equal(ParserState.GROUND);
|
||||
@@ -735,7 +738,7 @@ describe('EscapeSequenceParser', function (): void {
|
||||
it('state OSC_STRING ignore rules', function (): void {
|
||||
parser.reset();
|
||||
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',
|
||||
'\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x19', '\x1c', '\x1d', '\x1e', '\x1f'];
|
||||
for (let i = 0; i < ignored.length; ++i) {
|
||||
|
||||
@@ -82,7 +82,7 @@ export const VT500_TRANSITION_TABLE = (function (): TransitionTable {
|
||||
// range macro for byte
|
||||
const BYTE_VALUES = 256;
|
||||
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.
|
||||
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 _errorHandlerFb: (state: IParsingState) => IParsingState;
|
||||
|
||||
constructor(readonly TRANSITIONS: TransitionTable = VT500_TRANSITION_TABLE) {
|
||||
constructor(
|
||||
protected readonly _transitions: TransitionTable = VT500_TRANSITION_TABLE
|
||||
) {
|
||||
super();
|
||||
|
||||
this.initialState = ParserState.GROUND;
|
||||
@@ -471,7 +473,7 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
|
||||
const dcs = this._dcsParser;
|
||||
let collect = this._collect;
|
||||
const params = this._params;
|
||||
const table: Uint8Array = this.TRANSITIONS.table;
|
||||
const table: Uint8Array = this._transitions.table;
|
||||
|
||||
// process input string
|
||||
for (let i = 0; i < length; ++i) {
|
||||
|
||||
@@ -17,13 +17,13 @@ function toUtf32(s: string): Uint32Array {
|
||||
|
||||
class TestHandler implements IOscHandler {
|
||||
constructor(public id: number, public output: any[], public msg: string, public returnFalse: boolean = false) {}
|
||||
start(): void {
|
||||
public start(): void {
|
||||
this.output.push([this.msg, this.id, 'START']);
|
||||
}
|
||||
put(data: Uint32Array, start: number, end: number): void {
|
||||
public put(data: Uint32Array, start: number, end: number): void {
|
||||
this.output.push([this.msg, this.id, 'PUT', utf32ToString(data, start, end)]);
|
||||
}
|
||||
end(success: boolean): void | boolean {
|
||||
public end(success: boolean): void | boolean {
|
||||
this.output.push([this.msg, this.id, 'END', success]);
|
||||
if (this.returnFalse) {
|
||||
return false;
|
||||
|
||||
@@ -11,7 +11,7 @@ export const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars
|
||||
export const MINIMUM_ROWS = 1;
|
||||
|
||||
export class BufferService implements IBufferService {
|
||||
serviceBrand: any;
|
||||
public serviceBrand: any;
|
||||
|
||||
public cols: number;
|
||||
public rows: number;
|
||||
|
||||
@@ -7,7 +7,7 @@ import { ICharsetService } from 'common/services/Services';
|
||||
import { ICharset } from 'common/Types';
|
||||
|
||||
export class CharsetService implements ICharsetService {
|
||||
serviceBrand: any;
|
||||
public serviceBrand: any;
|
||||
|
||||
public charset: ICharset | undefined;
|
||||
public charsets: ICharset[] = [];
|
||||
|
||||
@@ -284,11 +284,11 @@ export class CoreMouseService implements ICoreMouseService {
|
||||
|
||||
public explainEvents(events: CoreMouseEventType): {[event: string]: boolean} {
|
||||
return {
|
||||
DOWN: !!(events & CoreMouseEventType.DOWN),
|
||||
UP: !!(events & CoreMouseEventType.UP),
|
||||
DRAG: !!(events & CoreMouseEventType.DRAG),
|
||||
MOVE: !!(events & CoreMouseEventType.MOVE),
|
||||
WHEEL: !!(events & CoreMouseEventType.WHEEL)
|
||||
down: !!(events & CoreMouseEventType.DOWN),
|
||||
up: !!(events & CoreMouseEventType.UP),
|
||||
drag: !!(events & CoreMouseEventType.DRAG),
|
||||
move: !!(events & CoreMouseEventType.MOVE),
|
||||
wheel: !!(events & CoreMouseEventType.WHEEL)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { ICoreService, ILogService, IOptionsService, IBufferService } from 'common/services/Services';
|
||||
import { EventEmitter, IEvent } from 'common/EventEmitter';
|
||||
import { IDecPrivateModes, ICharset } from 'common/Types';
|
||||
import { IDecPrivateModes } from 'common/Types';
|
||||
import { clone } from 'common/Clone';
|
||||
|
||||
const DEFAULT_DEC_PRIVATE_MODES: IDecPrivateModes = Object.freeze({
|
||||
@@ -17,7 +17,7 @@ const DEFAULT_DEC_PRIVATE_MODES: IDecPrivateModes = Object.freeze({
|
||||
});
|
||||
|
||||
export class CoreService implements ICoreService {
|
||||
serviceBrand: any;
|
||||
public serviceBrand: any;
|
||||
|
||||
public isCursorInitialized: boolean = false;
|
||||
public isCursorHidden: boolean = false;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { IBufferService, IDirtyRowService } from 'common/services/Services';
|
||||
|
||||
export class DirtyRowService implements IDirtyRowService {
|
||||
serviceBrand: any;
|
||||
public serviceBrand: any;
|
||||
|
||||
private _start!: number;
|
||||
private _end!: number;
|
||||
|
||||
@@ -22,21 +22,21 @@ export class ServiceCollection {
|
||||
}
|
||||
}
|
||||
|
||||
set<T>(id: IServiceIdentifier<T>, instance: T): T {
|
||||
public set<T>(id: IServiceIdentifier<T>, instance: T): T {
|
||||
const result = this._entries.get(id);
|
||||
this._entries.set(id, instance);
|
||||
return result;
|
||||
}
|
||||
|
||||
forEach(callback: (id: IServiceIdentifier<any>, instance: any) => any): void {
|
||||
public forEach(callback: (id: IServiceIdentifier<any>, instance: any) => any): void {
|
||||
this._entries.forEach((value, key) => callback(key, value));
|
||||
}
|
||||
|
||||
has(id: IServiceIdentifier<any>): boolean {
|
||||
public has(id: IServiceIdentifier<any>): boolean {
|
||||
return this._entries.has(id);
|
||||
}
|
||||
|
||||
get<T>(id: IServiceIdentifier<T>): T | undefined {
|
||||
public get<T>(id: IServiceIdentifier<T>): T | undefined {
|
||||
return this._entries.get(id);
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ export class InstantiationService implements IInstantiationService {
|
||||
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 serviceArgs: any[] = [];
|
||||
@@ -76,6 +76,6 @@ export class InstantiationService implements IInstantiationService {
|
||||
}
|
||||
|
||||
// now create the instance
|
||||
return <T>new ctor(...[...args, ...serviceArgs]);
|
||||
return new ctor(...[...args, ...serviceArgs]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ const optionsKeyToLogLevel: { [key: string]: LogLevel } = {
|
||||
const LOG_PREFIX = 'xterm.js: ';
|
||||
|
||||
export class LogService implements ILogService {
|
||||
serviceBrand: any;
|
||||
public serviceBrand: any;
|
||||
|
||||
private _logLevel!: LogLevel;
|
||||
|
||||
@@ -71,25 +71,25 @@ export class LogService implements ILogService {
|
||||
type.call(console, LOG_PREFIX + message, ...optionalParams);
|
||||
}
|
||||
|
||||
debug(message: string, ...optionalParams: any[]): void {
|
||||
public debug(message: string, ...optionalParams: any[]): void {
|
||||
if (this._logLevel <= LogLevel.DEBUG) {
|
||||
this._log(console.log, message, optionalParams);
|
||||
}
|
||||
}
|
||||
|
||||
info(message: string, ...optionalParams: any[]): void {
|
||||
public info(message: string, ...optionalParams: any[]): void {
|
||||
if (this._logLevel <= LogLevel.INFO) {
|
||||
this._log(console.info, message, optionalParams);
|
||||
}
|
||||
}
|
||||
|
||||
warn(message: string, ...optionalParams: any[]): void {
|
||||
public warn(message: string, ...optionalParams: any[]): void {
|
||||
if (this._logLevel <= LogLevel.WARN) {
|
||||
this._log(console.warn, message, optionalParams);
|
||||
}
|
||||
}
|
||||
|
||||
error(message: string, ...optionalParams: any[]): void {
|
||||
public error(message: string, ...optionalParams: any[]): void {
|
||||
if (this._logLevel <= LogLevel.ERROR) {
|
||||
this._log(console.error, message, optionalParams);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ export const DEFAULT_OPTIONS: ITerminalOptions = Object.freeze({
|
||||
fontWeight: 'normal',
|
||||
fontWeightBold: 'bold',
|
||||
lineHeight: 1.0,
|
||||
linkTooltipHoverDuration: 500,
|
||||
letterSpacing: 0,
|
||||
logLevel: 'info',
|
||||
scrollback: 1000,
|
||||
@@ -60,7 +61,7 @@ export const DEFAULT_OPTIONS: ITerminalOptions = Object.freeze({
|
||||
const CONSTRUCTOR_ONLY_OPTIONS = ['cols', 'rows'];
|
||||
|
||||
export class OptionsService implements IOptionsService {
|
||||
serviceBrand: any;
|
||||
public serviceBrand: any;
|
||||
|
||||
public options: ITerminalOptions;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ export function createDecorator<T>(id: string): IServiceIdentifier<T> {
|
||||
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) {
|
||||
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.
|
||||
* @param data The data that is being emitted.
|
||||
*/
|
||||
triggerBinaryEvent(data: string): void;
|
||||
triggerBinaryEvent(data: string): void;
|
||||
}
|
||||
|
||||
export const ICharsetService = createDecorator<ICharsetService>('CharsetService');
|
||||
@@ -104,7 +104,7 @@ export interface ICharsetService {
|
||||
* Set the G level of the terminal.
|
||||
* @param g
|
||||
*/
|
||||
setgLevel(g: number): void;
|
||||
setgLevel(g: number): void;
|
||||
|
||||
/**
|
||||
* Set the charset for the given G level of the terminal.
|
||||
@@ -133,39 +133,39 @@ export interface IServiceIdentifier<T> {
|
||||
}
|
||||
|
||||
export interface IConstructorSignature0<T> {
|
||||
new(...services: { serviceBrand: any; }[]): T;
|
||||
new(...services: { serviceBrand: any }[]): 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> {
|
||||
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> {
|
||||
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> {
|
||||
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> {
|
||||
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> {
|
||||
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> {
|
||||
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> {
|
||||
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');
|
||||
@@ -213,7 +213,7 @@ export type RendererType = 'dom' | 'canvas';
|
||||
export interface IPartialTerminalOptions {
|
||||
allowTransparency?: boolean;
|
||||
bellSound?: string;
|
||||
bellStyle?: 'none' /*| 'visual'*/ | 'sound' /*| 'both'*/;
|
||||
bellStyle?: 'none' | 'sound' /* | 'visual' | 'both' */;
|
||||
cols?: number;
|
||||
cursorBlink?: boolean;
|
||||
cursorStyle?: 'block' | 'underline' | 'bar';
|
||||
@@ -247,7 +247,7 @@ export interface IPartialTerminalOptions {
|
||||
export interface ITerminalOptions {
|
||||
allowTransparency: boolean;
|
||||
bellSound: string;
|
||||
bellStyle: 'none' /*| 'visual'*/ | 'sound' /*| 'both'*/;
|
||||
bellStyle: 'none' | 'sound' /* | 'visual' | 'both' */;
|
||||
cols: number;
|
||||
cursorBlink: boolean;
|
||||
cursorStyle: 'block' | 'underline' | 'bar';
|
||||
@@ -262,6 +262,7 @@ export interface ITerminalOptions {
|
||||
fontWeightBold: FontWeight;
|
||||
letterSpacing: number;
|
||||
lineHeight: number;
|
||||
linkTooltipHoverDuration: number;
|
||||
logLevel: LogLevel;
|
||||
macOptionIsMeta: boolean;
|
||||
macOptionClickForcesSelection: boolean;
|
||||
@@ -310,6 +311,7 @@ export interface ITheme {
|
||||
|
||||
export const IUnicodeService = createDecorator<IUnicodeService>('UnicodeService');
|
||||
export interface IUnicodeService {
|
||||
serviceBrand: any;
|
||||
/** Register an Unicode version provider. */
|
||||
register(provider: IUnicodeVersionProvider): void;
|
||||
/** Registered Unicode versions. */
|
||||
|
||||
@@ -8,8 +8,8 @@ import { UnicodeService } from 'common/services/UnicodeService';
|
||||
import { IUnicodeVersionProvider } from 'common/services/Services';
|
||||
|
||||
class DummyProvider implements IUnicodeVersionProvider {
|
||||
version = '123';
|
||||
wcwidth(n: number): 0 | 1 | 2 {
|
||||
public version = '123';
|
||||
public wcwidth(n: number): 0 | 1 | 2 {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import { UnicodeV6 } from 'common/input/UnicodeV6';
|
||||
|
||||
|
||||
export class UnicodeService implements IUnicodeService {
|
||||
public serviceBrand: any;
|
||||
|
||||
private _providers: {[key: string]: IUnicodeVersionProvider} = Object.create(null);
|
||||
private _active: string = '';
|
||||
private _activeProvider: IUnicodeVersionProvider;
|
||||
|
||||
Reference in New Issue
Block a user