Merge pull request #2844 from Tyriar/2824

Enforce explicit access modifiers
This commit is contained in:
Daniel Imms
2020-04-14 06:36:34 -07:00
committed by GitHub
37 changed files with 327 additions and 317 deletions
+9
View File
@@ -45,6 +45,15 @@
"allowExpressions": true
}
],
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "explicit",
"overrides": {
"constructors": "off"
}
}
],
"@typescript-eslint/indent": [
"error",
2
@@ -11,7 +11,7 @@ import { Terminal } from 'public/Terminal';
import { SerializeAddon } from 'SerializeAddon';
class TestTerminal extends Terminal {
writeSync(data: string): void {
public writeSync(data: string): void {
(this as any)._core.writeSync(data);
}
}
@@ -15,7 +15,7 @@ function constrain(value: number, low: number, high: number): number {
abstract class BaseSerializeHandler {
constructor(private _buffer: IBuffer) { }
serialize(startRow: number, endRow: number): string {
public serialize(startRow: number, endRow: number): string {
// we need two of them to flip between old and new cell
const cell1 = this._buffer.getNullCell();
const cell2 = this._buffer.getNullCell();
@@ -15,7 +15,7 @@ export class WebLinkProvider implements ILinkProvider {
}
provideLink(position: IBufferCellPosition, callback: (link: ILink | undefined) => void): void {
public provideLink(position: IBufferCellPosition, callback: (link: ILink | undefined) => void): void {
callback(LinkComputer.computeLink(position, this._regex, this._terminal, this._handler));
}
}
+1 -1
View File
@@ -34,7 +34,7 @@ function getLines(term: TestTerminal, limit: number = term.rows): string[] {
}
class TestInputHandler extends InputHandler {
get curAttrData(): IAttributeData { return (this as any)._curAttrData; }
public get curAttrData(): IAttributeData { return (this as any)._curAttrData; }
}
describe('InputHandler', () => {
+3 -3
View File
@@ -137,15 +137,15 @@ class DECRQSS implements IDcsHandler {
private _optionsService: IOptionsService
) { }
hook(params: IParams): void {
public hook(params: IParams): void {
this._data = new Uint32Array(0);
}
put(data: Uint32Array, start: number, end: number): void {
public put(data: Uint32Array, start: number, end: number): void {
this._data = concat(this._data, data.subarray(start, end));
}
unhook(success: boolean): void {
public unhook(success: boolean): void {
if (!success) {
this._data = new Uint32Array(0);
return;
+3 -3
View File
@@ -1416,14 +1416,14 @@ class TestLinkifier extends Linkifier {
}
class TestMouseZoneManager implements IMouseZoneManager {
dispose(): void {
public dispose(): void {
}
public clears: number = 0;
public zones: IMouseZone[] = [];
add(zone: IMouseZone): void {
public add(zone: IMouseZone): void {
this.zones.push(zone);
}
clearAll(): void {
public clearAll(): void {
this.clears++;
}
}
+166 -166
View File
@@ -19,342 +19,342 @@ import { IParams, IFunctionIdentifier } from 'common/parser/Types';
import { ISelectionService } from 'browser/services/Services';
export class TestTerminal extends Terminal {
get curAttrData(): IAttributeData { return (this as any)._inputHandler._curAttrData; }
keyDown(ev: any): boolean { return this._keyDown(ev); }
keyPress(ev: any): boolean { return this._keyPress(ev); }
public get curAttrData(): IAttributeData { return (this as any)._inputHandler._curAttrData; }
public keyDown(ev: any): boolean { return this._keyDown(ev); }
public keyPress(ev: any): boolean { return this._keyPress(ev); }
}
export class MockTerminal implements ITerminal {
onBlur: IEvent<void>;
onFocus: IEvent<void>;
onA11yChar: IEvent<string>;
onA11yTab: IEvent<number>;
onCursorMove: IEvent<void>;
onLineFeed: IEvent<void>;
onSelectionChange: IEvent<void>;
onData: IEvent<string>;
onBinary: IEvent<string>;
onTitleChange: IEvent<string>;
onScroll: IEvent<number>;
onKey: IEvent<{ key: string, domEvent: KeyboardEvent }>;
onRender: IEvent<{ start: number, end: number }>;
onResize: IEvent<{ cols: number, rows: number }>;
markers: IMarker[];
optionsService: IOptionsService;
unicodeService: IUnicodeService;
addMarker(cursorYOffset: number): IMarker {
public onBlur: IEvent<void>;
public onFocus: IEvent<void>;
public onA11yChar: IEvent<string>;
public onA11yTab: IEvent<number>;
public onCursorMove: IEvent<void>;
public onLineFeed: IEvent<void>;
public onSelectionChange: IEvent<void>;
public onData: IEvent<string>;
public onBinary: IEvent<string>;
public onTitleChange: IEvent<string>;
public onScroll: IEvent<number>;
public onKey: IEvent<{ key: string, domEvent: KeyboardEvent }>;
public onRender: IEvent<{ start: number, end: number }>;
public onResize: IEvent<{ cols: number, rows: number }>;
public markers: IMarker[];
public optionsService: IOptionsService;
public unicodeService: IUnicodeService;
public addMarker(cursorYOffset: number): IMarker {
throw new Error('Method not implemented.');
}
selectLines(start: number, end: number): void {
public selectLines(start: number, end: number): void {
throw new Error('Method not implemented.');
}
scrollToLine(line: number): void {
public scrollToLine(line: number): void {
throw new Error('Method not implemented.');
}
static string: any;
setOption(key: any, value: any): void {
public static string: any;
public setOption(key: any, value: any): void {
throw new Error('Method not implemented.');
}
blur(): void {
public blur(): void {
throw new Error('Method not implemented.');
}
focus(): void {
public focus(): void {
throw new Error('Method not implemented.');
}
resize(columns: number, rows: number): void {
public resize(columns: number, rows: number): void {
throw new Error('Method not implemented.');
}
writeln(data: string): void {
public writeln(data: string): void {
throw new Error('Method not implemented.');
}
paste(data: string): void {
public paste(data: string): void {
throw new Error('Method not implemented.');
}
open(parent: HTMLElement): void {
public open(parent: HTMLElement): void {
throw new Error('Method not implemented.');
}
attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void {
public attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void {
throw new Error('Method not implemented.');
}
addCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean): IDisposable {
public addCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean): IDisposable {
throw new Error('Method not implemented.');
}
addDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean): IDisposable {
public addDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean): IDisposable {
throw new Error('Method not implemented.');
}
addEscHandler(id: IFunctionIdentifier, handler: () => boolean): IDisposable {
public addEscHandler(id: IFunctionIdentifier, handler: () => boolean): IDisposable {
throw new Error('Method not implemented.');
}
addOscHandler(ident: number, callback: (data: string) => boolean): IDisposable {
public addOscHandler(ident: number, callback: (data: string) => boolean): IDisposable {
throw new Error('Method not implemented.');
}
registerLinkMatcher(regex: RegExp, handler: (event: MouseEvent, uri: string) => boolean | void, options?: ILinkMatcherOptions): number {
public registerLinkMatcher(regex: RegExp, handler: (event: MouseEvent, uri: string) => boolean | void, options?: ILinkMatcherOptions): number {
throw new Error('Method not implemented.');
}
deregisterLinkMatcher(matcherId: number): void {
public deregisterLinkMatcher(matcherId: number): void {
throw new Error('Method not implemented.');
}
registerLinkProvider(linkProvider: ILinkProvider): IDisposable {
public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {
throw new Error('Method not implemented.');
}
hasSelection(): boolean {
public hasSelection(): boolean {
throw new Error('Method not implemented.');
}
getSelection(): string {
public getSelection(): string {
throw new Error('Method not implemented.');
}
getSelectionPosition(): ISelectionPosition | undefined {
public getSelectionPosition(): ISelectionPosition | undefined {
throw new Error('Method not implemented.');
}
clearSelection(): void {
public clearSelection(): void {
throw new Error('Method not implemented.');
}
select(column: number, row: number, length: number): void {
public select(column: number, row: number, length: number): void {
throw new Error('Method not implemented.');
}
selectAll(): void {
public selectAll(): void {
throw new Error('Method not implemented.');
}
dispose(): void {
public dispose(): void {
throw new Error('Method not implemented.');
}
scrollPages(pageCount: number): void {
public scrollPages(pageCount: number): void {
throw new Error('Method not implemented.');
}
scrollToTop(): void {
public scrollToTop(): void {
throw new Error('Method not implemented.');
}
scrollToBottom(): void {
public scrollToBottom(): void {
throw new Error('Method not implemented.');
}
clear(): void {
public clear(): void {
throw new Error('Method not implemented.');
}
write(data: string): void {
public write(data: string): void {
throw new Error('Method not implemented.');
}
writeUtf8(data: Uint8Array): void {
public writeUtf8(data: Uint8Array): void {
throw new Error('Method not implemented.');
}
bracketedPasteMode: boolean;
renderer: IRenderer;
linkifier: ILinkifier;
linkifier2: ILinkifier2;
isFocused: boolean;
options: ITerminalOptions = {};
element: HTMLElement;
screenElement: HTMLElement;
rowContainer: HTMLElement;
selectionContainer: HTMLElement;
selectionService: ISelectionService;
textarea: HTMLTextAreaElement;
rows: number;
cols: number;
browser: IBrowser = <any>Browser;
writeBuffer: string[];
children: HTMLElement[];
cursorHidden: boolean;
cursorState: number;
scrollback: number;
buffers: IBufferSet;
buffer: IBuffer;
viewport: IViewport;
applicationCursor: boolean;
handler(data: string): void {
public bracketedPasteMode: boolean;
public renderer: IRenderer;
public linkifier: ILinkifier;
public linkifier2: ILinkifier2;
public isFocused: boolean;
public options: ITerminalOptions = {};
public element: HTMLElement;
public screenElement: HTMLElement;
public rowContainer: HTMLElement;
public selectionContainer: HTMLElement;
public selectionService: ISelectionService;
public textarea: HTMLTextAreaElement;
public rows: number;
public cols: number;
public browser: IBrowser = <any>Browser;
public writeBuffer: string[];
public children: HTMLElement[];
public cursorHidden: boolean;
public cursorState: number;
public scrollback: number;
public buffers: IBufferSet;
public buffer: IBuffer;
public viewport: IViewport;
public applicationCursor: boolean;
public handler(data: string): void {
throw new Error('Method not implemented.');
}
on(event: string, callback: (...args: any[]) => void): void {
public on(event: string, callback: (...args: any[]) => void): void {
throw new Error('Method not implemented.');
}
off(type: string, listener: XtermListener): void {
public off(type: string, listener: XtermListener): void {
throw new Error('Method not implemented.');
}
addDisposableListener(type: string, handler: XtermListener): IDisposable {
public addDisposableListener(type: string, handler: XtermListener): IDisposable {
throw new Error('Method not implemented.');
}
scrollLines(disp: number, suppressScrollEvent: boolean): void {
public scrollLines(disp: number, suppressScrollEvent: boolean): void {
throw new Error('Method not implemented.');
}
scrollToRow(absoluteRow: number): number {
public scrollToRow(absoluteRow: number): number {
throw new Error('Method not implemented.');
}
cancel(ev: Event, force?: boolean): void {
public cancel(ev: Event, force?: boolean): void {
throw new Error('Method not implemented.');
}
log(text: string): void {
public log(text: string): void {
throw new Error('Method not implemented.');
}
emit(event: string, data: any): void {
public emit(event: string, data: any): void {
throw new Error('Method not implemented.');
}
reset(): void {
public reset(): void {
throw new Error('Method not implemented.');
}
showCursor(): void {
public showCursor(): void {
throw new Error('Method not implemented.');
}
refresh(start: number, end: number): void {
public refresh(start: number, end: number): void {
throw new Error('Method not implemented.');
}
registerCharacterJoiner(handler: CharacterJoinerHandler): number { return 0; }
deregisterCharacterJoiner(joinerId: number): void { }
public registerCharacterJoiner(handler: CharacterJoinerHandler): number { return 0; }
public deregisterCharacterJoiner(joinerId: number): void { }
}
export class MockInputHandlingTerminal implements IInputHandlingTerminal {
onA11yCharEmitter: EventEmitter<string>;
onA11yTabEmitter: EventEmitter<number>;
insertMode: boolean;
bracketedPasteMode: boolean;
sendFocus: boolean;
buffers: IBufferSet;
buffer: IBuffer = new MockBuffer();
viewport: IViewport;
scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void {
public onA11yCharEmitter: EventEmitter<string>;
public onA11yTabEmitter: EventEmitter<number>;
public insertMode: boolean;
public bracketedPasteMode: boolean;
public sendFocus: boolean;
public buffers: IBufferSet;
public buffer: IBuffer = new MockBuffer();
public viewport: IViewport;
public scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void {
throw new Error('Method not implemented.');
}
is(term: string): boolean {
public is(term: string): boolean {
throw new Error('Method not implemented.');
}
resize(x: number, y: number): void {
public resize(x: number, y: number): void {
throw new Error('Method not implemented.');
}
showCursor(): void {
public showCursor(): void {
throw new Error('Method not implemented.');
}
handler(data: string): void {
public handler(data: string): void {
throw new Error('Method not implemented.');
}
handleTitle(title: string): void {
public handleTitle(title: string): void {
throw new Error('Method not implemented.');
}
}
export class MockBuffer implements IBuffer {
markers: IMarker[];
addMarker(y: number): IMarker {
public markers: IMarker[];
public addMarker(y: number): IMarker {
throw new Error('Method not implemented.');
}
isCursorInViewport: boolean;
lines: ICircularList<IBufferLine>;
ydisp: number;
ybase: number;
hasScrollback: boolean;
y: number;
x: number;
tabs: any;
scrollBottom: number;
scrollTop: number;
savedY: number;
savedX: number;
savedCharset: ICharset | null;
savedCurAttrData = new AttributeData();
translateBufferLineToString(lineIndex: number, trimRight: boolean, startCol?: number, endCol?: number): string {
public isCursorInViewport: boolean;
public lines: ICircularList<IBufferLine>;
public ydisp: number;
public ybase: number;
public hasScrollback: boolean;
public y: number;
public x: number;
public tabs: any;
public scrollBottom: number;
public scrollTop: number;
public savedY: number;
public savedX: number;
public savedCharset: ICharset | null;
public savedCurAttrData = new AttributeData();
public translateBufferLineToString(lineIndex: number, trimRight: boolean, startCol?: number, endCol?: number): string {
return Buffer.prototype.translateBufferLineToString.apply(this, arguments);
}
getWrappedRangeForLine(y: number): { first: number, last: number } {
public getWrappedRangeForLine(y: number): { first: number, last: number } {
return Buffer.prototype.getWrappedRangeForLine.apply(this, arguments);
}
nextStop(x?: number): number {
public nextStop(x?: number): number {
throw new Error('Method not implemented.');
}
prevStop(x?: number): number {
public prevStop(x?: number): number {
throw new Error('Method not implemented.');
}
setLines(lines: ICircularList<IBufferLine>): void {
public setLines(lines: ICircularList<IBufferLine>): void {
this.lines = lines;
}
getBlankLine(attr: IAttributeData, isWrapped?: boolean): IBufferLine {
public getBlankLine(attr: IAttributeData, isWrapped?: boolean): IBufferLine {
return Buffer.prototype.getBlankLine.apply(this, arguments);
}
stringIndexToBufferIndex(lineIndex: number, stringIndex: number): number[] {
public stringIndexToBufferIndex(lineIndex: number, stringIndex: number): number[] {
return Buffer.prototype.stringIndexToBufferIndex.apply(this, arguments);
}
iterator(trimRight: boolean, startIndex?: number, endIndex?: number): IBufferStringIterator {
public iterator(trimRight: boolean, startIndex?: number, endIndex?: number): IBufferStringIterator {
return Buffer.prototype.iterator.apply(this, arguments);
}
getNullCell(attr?: IAttributeData): ICellData {
public getNullCell(attr?: IAttributeData): ICellData {
throw new Error('Method not implemented.');
}
getWhitespaceCell(attr?: IAttributeData): ICellData {
public getWhitespaceCell(attr?: IAttributeData): ICellData {
throw new Error('Method not implemented.');
}
}
export class MockRenderer implements IRenderer {
onRequestRedraw: IEvent<IRequestRedrawEvent>;
onCanvasResize: IEvent<{ width: number, height: number }>;
onRender: IEvent<{ start: number, end: number }>;
dispose(): void {
public onRequestRedraw: IEvent<IRequestRedrawEvent>;
public onCanvasResize: IEvent<{ width: number, height: number }>;
public onRender: IEvent<{ start: number, end: number }>;
public dispose(): void {
throw new Error('Method not implemented.');
}
colorManager: IColorManager;
on(type: string, listener: XtermListener): void {
public colorManager: IColorManager;
public on(type: string, listener: XtermListener): void {
throw new Error('Method not implemented.');
}
off(type: string, listener: XtermListener): void {
public off(type: string, listener: XtermListener): void {
throw new Error('Method not implemented.');
}
emit(type: string, data?: any): void {
public emit(type: string, data?: any): void {
throw new Error('Method not implemented.');
}
addDisposableListener(type: string, handler: XtermListener): IDisposable {
public addDisposableListener(type: string, handler: XtermListener): IDisposable {
throw new Error('Method not implemented.');
}
dimensions: IRenderDimensions;
setColors(colors: IColorSet): void {
public dimensions: IRenderDimensions;
public setColors(colors: IColorSet): void {
throw new Error('Method not implemented.');
}
onResize(cols: number, rows: number): void { }
onCharSizeChanged(): void { }
onBlur(): void { }
onFocus(): void { }
onSelectionChanged(start: [number, number], end: [number, number]): void { }
onCursorMove(): void { }
onOptionsChanged(): void { }
onDevicePixelRatioChange(): void { }
clear(): void { }
renderRows(start: number, end: number): void { }
registerCharacterJoiner(handler: CharacterJoinerHandler): number { return 0; }
deregisterCharacterJoiner(): boolean { return true; }
public onResize(cols: number, rows: number): void { }
public onCharSizeChanged(): void { }
public onBlur(): void { }
public onFocus(): void { }
public onSelectionChanged(start: [number, number], end: [number, number]): void { }
public onCursorMove(): void { }
public onOptionsChanged(): void { }
public onDevicePixelRatioChange(): void { }
public clear(): void { }
public renderRows(start: number, end: number): void { }
public registerCharacterJoiner(handler: CharacterJoinerHandler): number { return 0; }
public deregisterCharacterJoiner(): boolean { return true; }
}
export class MockViewport implements IViewport {
dispose(): void {
public dispose(): void {
throw new Error('Method not implemented.');
}
scrollBarWidth: number = 0;
onThemeChange(colors: IColorSet): void {
public scrollBarWidth: number = 0;
public onThemeChange(colors: IColorSet): void {
throw new Error('Method not implemented.');
}
onWheel(ev: WheelEvent): boolean {
public onWheel(ev: WheelEvent): boolean {
throw new Error('Method not implemented.');
}
onTouchStart(ev: TouchEvent): void {
public onTouchStart(ev: TouchEvent): void {
throw new Error('Method not implemented.');
}
onTouchMove(ev: TouchEvent): boolean {
public onTouchMove(ev: TouchEvent): boolean {
throw new Error('Method not implemented.');
}
syncScrollArea(): void { }
getLinesScrolled(ev: WheelEvent): number {
public syncScrollArea(): void { }
public getLinesScrolled(ev: WheelEvent): number {
throw new Error('Method not implemented.');
}
}
export class MockCompositionHelper implements ICompositionHelper {
compositionstart(): void {
public compositionstart(): void {
throw new Error('Method not implemented.');
}
compositionupdate(ev: CompositionEvent): void {
public compositionupdate(ev: CompositionEvent): void {
throw new Error('Method not implemented.');
}
compositionend(): void {
public compositionend(): void {
throw new Error('Method not implemented.');
}
updateCompositionElements(dontRecurse?: boolean): void {
public updateCompositionElements(dontRecurse?: boolean): void {
throw new Error('Method not implemented.');
}
keydown(ev: KeyboardEvent): boolean {
public keydown(ev: KeyboardEvent): boolean {
return true;
}
}
+3 -3
View File
@@ -24,14 +24,14 @@ class TestLinkifier extends Linkifier {
}
class TestMouseZoneManager implements IMouseZoneManager {
dispose(): void {
public dispose(): void {
}
public clears: number = 0;
public zones: IMouseZone[] = [];
add(zone: IMouseZone): void {
public add(zone: IMouseZone): void {
this.zones.push(zone);
}
clearAll(): void {
public clearAll(): void {
this.clears++;
}
}
+26 -26
View File
@@ -9,15 +9,15 @@ import { IRenderDimensions, IRenderer, CharacterJoinerHandler } from 'browser/re
import { IColorSet } from 'browser/Types';
export class MockCharSizeService implements ICharSizeService {
serviceBrand: any;
get hasValidSize(): boolean { return this.width > 0 && this.height > 0; }
onCharSizeChange: IEvent<void> = new EventEmitter<void>().event;
public serviceBrand: any;
public get hasValidSize(): boolean { return this.width > 0 && this.height > 0; }
public onCharSizeChange: IEvent<void> = new EventEmitter<void>().event;
constructor(public width: number, public height: number) {}
measure(): void {}
public measure(): void {}
}
export class MockMouseService implements IMouseService {
serviceBrand: any;
public serviceBrand: any;
public getCoords(event: {clientX: number, clientY: number}, element: HTMLElement, colCount: number, rowCount: number, isSelection?: boolean): [number, number] | undefined {
throw new Error('Not implemented');
}
@@ -28,11 +28,11 @@ export class MockMouseService implements IMouseService {
}
export class MockRenderService implements IRenderService {
serviceBrand: any;
onDimensionsChange: IEvent<IRenderDimensions> = new EventEmitter<IRenderDimensions>().event;
onRenderedBufferChange: IEvent<{ start: number, end: number }, void> = new EventEmitter<{ start: number, end: number }>().event;
onRefreshRequest: IEvent<{ start: number, end: number}, void> = new EventEmitter<{ start: number, end: number }>().event;
dimensions: IRenderDimensions = {
public serviceBrand: any;
public onDimensionsChange: IEvent<IRenderDimensions> = new EventEmitter<IRenderDimensions>().event;
public onRenderedBufferChange: IEvent<{ start: number, end: number }, void> = new EventEmitter<{ start: number, end: number }>().event;
public onRefreshRequest: IEvent<{ start: number, end: number}, void> = new EventEmitter<{ start: number, end: number }>().event;
public dimensions: IRenderDimensions = {
scaledCharWidth: 0,
scaledCharHeight: 0,
scaledCellWidth: 0,
@@ -46,52 +46,52 @@ export class MockRenderService implements IRenderService {
actualCellWidth: 0,
actualCellHeight: 0
};
refreshRows(start: number, end: number): void {
public refreshRows(start: number, end: number): void {
throw new Error('Method not implemented.');
}
resize(cols: number, rows: number): void {
public resize(cols: number, rows: number): void {
throw new Error('Method not implemented.');
}
changeOptions(): void {
public changeOptions(): void {
throw new Error('Method not implemented.');
}
setRenderer(renderer: IRenderer): void {
public setRenderer(renderer: IRenderer): void {
throw new Error('Method not implemented.');
}
setColors(colors: IColorSet): void {
public setColors(colors: IColorSet): void {
throw new Error('Method not implemented.');
}
onDevicePixelRatioChange(): void {
public onDevicePixelRatioChange(): void {
throw new Error('Method not implemented.');
}
onResize(cols: number, rows: number): void {
public onResize(cols: number, rows: number): void {
throw new Error('Method not implemented.');
}
onCharSizeChanged(): void {
public onCharSizeChanged(): void {
throw new Error('Method not implemented.');
}
onBlur(): void {
public onBlur(): void {
throw new Error('Method not implemented.');
}
onFocus(): void {
public onFocus(): void {
throw new Error('Method not implemented.');
}
onSelectionChanged(start: [number, number], end: [number, number], columnSelectMode: boolean): void {
public onSelectionChanged(start: [number, number], end: [number, number], columnSelectMode: boolean): void {
throw new Error('Method not implemented.');
}
onCursorMove(): void {
public onCursorMove(): void {
throw new Error('Method not implemented.');
}
clear(): void {
public clear(): void {
throw new Error('Method not implemented.');
}
registerCharacterJoiner(handler: CharacterJoinerHandler): number {
public registerCharacterJoiner(handler: CharacterJoinerHandler): number {
throw new Error('Method not implemented.');
}
deregisterCharacterJoiner(joinerId: number): boolean {
public deregisterCharacterJoiner(joinerId: number): boolean {
throw new Error('Method not implemented.');
}
dispose(): void {
public dispose(): void {
throw new Error('Method not implemented.');
}
}
+2 -2
View File
@@ -37,8 +37,8 @@ export class CursorRenderLayer extends BaseRenderLayer {
colors: IColorSet,
rendererId: number,
private _onRequestRedraw: IEventEmitter<IRequestRedrawEvent>,
readonly bufferService: IBufferService,
readonly optionsService: IOptionsService,
bufferService: IBufferService,
optionsService: IOptionsService,
private readonly _coreService: ICoreService,
private readonly _coreBrowserService: ICoreBrowserService
) {
+2 -2
View File
@@ -20,8 +20,8 @@ export class LinkRenderLayer extends BaseRenderLayer {
rendererId: number,
linkifier: ILinkifier,
linkifier2: ILinkifier2,
readonly bufferService: IBufferService,
readonly optionsService: IOptionsService
bufferService: IBufferService,
optionsService: IOptionsService
) {
super(container, 'link', zIndex, true, colors, rendererId, bufferService, optionsService);
linkifier.onLinkHover(e => this._onLinkHover(e));
+4 -4
View File
@@ -33,13 +33,13 @@ export class Renderer extends Disposable implements IRenderer {
constructor(
private _colors: IColorSet,
private readonly _screenElement: HTMLElement,
readonly linkifier: ILinkifier,
readonly linkifier2: ILinkifier2,
linkifier: ILinkifier,
linkifier2: ILinkifier2,
@IBufferService private readonly _bufferService: IBufferService,
@ICharSizeService private readonly _charSizeService: ICharSizeService,
@IOptionsService private readonly _optionsService: IOptionsService,
@ICoreService readonly coreService: ICoreService,
@ICoreBrowserService readonly coreBrowserService: ICoreBrowserService
@ICoreService coreService: ICoreService,
@ICoreBrowserService coreBrowserService: ICoreBrowserService
) {
super();
const allowTransparency = this._optionsService.options.allowTransparency;
+2 -2
View File
@@ -23,8 +23,8 @@ export class SelectionRenderLayer extends BaseRenderLayer {
zIndex: number,
colors: IColorSet,
rendererId: number,
readonly bufferService: IBufferService,
readonly optionsService: IOptionsService
bufferService: IBufferService,
optionsService: IOptionsService
) {
super(container, 'selection', zIndex, true, colors, rendererId, bufferService, optionsService);
this._clearState();
+2 -2
View File
@@ -36,8 +36,8 @@ export class TextRenderLayer extends BaseRenderLayer {
characterJoinerRegistry: ICharacterJoinerRegistry,
alpha: boolean,
rendererId: number,
readonly bufferService: IBufferService,
readonly optionsService: IOptionsService
bufferService: IBufferService,
optionsService: IOptionsService
) {
super(container, 'text', zIndex, alpha, colors, rendererId, bufferService, optionsService);
this._state = new GridCache<CharData>();
+3 -3
View File
@@ -8,7 +8,7 @@ import { IEvent, EventEmitter } from 'common/EventEmitter';
import { ICharSizeService } from 'browser/services/Services';
export class CharSizeService implements ICharSizeService {
serviceBrand: any;
public serviceBrand: any;
public width: number = 0;
public height: number = 0;
@@ -20,8 +20,8 @@ export class CharSizeService implements ICharSizeService {
public get onCharSizeChange(): IEvent<void> { return this._onCharSizeChange.event; }
constructor(
readonly document: Document,
readonly parentElement: HTMLElement,
document: Document,
parentElement: HTMLElement,
@IOptionsService private readonly _optionsService: IOptionsService
) {
this._measureStrategy = new DomMeasureStrategy(document, parentElement, this._optionsService);
+1 -1
View File
@@ -6,7 +6,7 @@
import { ICoreBrowserService } from './Services';
export class CoreBrowserService implements ICoreBrowserService {
serviceBrand: any;
public serviceBrand: any;
constructor(
private _textarea: HTMLTextAreaElement
+1 -1
View File
@@ -7,7 +7,7 @@ import { ICharSizeService, IRenderService, IMouseService } from './Services';
import { getCoords, getRawByteCoords } from 'browser/input/Mouse';
export class MouseService implements IMouseService {
serviceBrand: any;
public serviceBrand: any;
constructor(
@IRenderService private readonly _renderService: IRenderService,
+4 -4
View File
@@ -14,7 +14,7 @@ import { IOptionsService } from 'common/services/Services';
import { ICharSizeService, IRenderService } from 'browser/services/Services';
export class RenderService extends Disposable implements IRenderService {
serviceBrand: any;
public serviceBrand: any;
private _renderDebouncer: RenderDebouncer;
private _screenDprMonitor: ScreenDprMonitor;
@@ -37,9 +37,9 @@ export class RenderService extends Disposable implements IRenderService {
constructor(
private _renderer: IRenderer,
private _rowCount: number,
readonly screenElement: HTMLElement,
@IOptionsService readonly optionsService: IOptionsService,
@ICharSizeService readonly charSizeService: ICharSizeService
screenElement: HTMLElement,
@IOptionsService optionsService: IOptionsService,
@ICharSizeService charSizeService: ICharSizeService
) {
super();
this._renderDebouncer = new RenderDebouncer((start, end) => this._renderRows(start, end));
+1 -1
View File
@@ -67,7 +67,7 @@ export const enum SelectionMode {
* when the selection is ready to be redrawn (on an animation frame).
*/
export class SelectionService implements ISelectionService {
serviceBrand: any;
public serviceBrand: any;
protected _model: SelectionModel;
+2 -2
View File
@@ -7,11 +7,11 @@ import { IOptionsService } from 'common/services/Services';
import { ISoundService } from 'browser/services/Services';
export class SoundService implements ISoundService {
serviceBrand: any;
public serviceBrand: any;
private static _audioContext: AudioContext;
static get audioContext(): AudioContext | null {
public static get audioContext(): AudioContext | null {
if (!SoundService._audioContext) {
const audioContextCtor: typeof AudioContext = (<any>window).AudioContext || (<any>window).webkitAudioContext;
if (!audioContextCtor) {
+52 -52
View File
@@ -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,86 +23,86 @@ 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: ReadonlyArray<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,
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.');
}
}
@@ -110,14 +110,14 @@ export class MockOptionsService implements IOptionsService {
// defaults to V6 always to keep tests passing
export class MockUnicodeService implements IUnicodeService {
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): 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.');
}
}
+3 -2
View File
@@ -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;
}
+2 -2
View File
@@ -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();
+2 -2
View File
@@ -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) {
+3 -3
View File
@@ -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;
}
}
+3 -3
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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[] = [];
+1 -1
View File
@@ -16,7 +16,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;
+1 -1
View File
@@ -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;
+4 -4
View File
@@ -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);
}
}
+5 -5
View File
@@ -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);
}
+1 -1
View File
@@ -61,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;
+2 -2
View File
@@ -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;
}
}
+4 -4
View File
@@ -24,11 +24,11 @@ describe('AddonManager', () => {
it('should call addon constructor', () => {
let called = false;
class Addon implements ITerminalAddon {
activate(terminal: any): void {
public activate(terminal: any): void {
assert.equal(terminal, 'foo', 'The first constructor arg should be Terminal');
called = true;
}
dispose(): void { }
public dispose(): void { }
}
manager.loadAddon('foo' as any, new Addon());
assert.equal(called, true);
@@ -39,8 +39,8 @@ describe('AddonManager', () => {
it('should dispose all loaded addons', () => {
let called = 0;
class Addon implements ITerminalAddon {
activate(): void {}
dispose(): void { called++; }
public activate(): void {}
public dispose(): void { called++; }
}
manager.loadAddon(null, new Addon());
manager.loadAddon(null, new Addon());