Migrate most EventEmitter to base/ Emitter
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
|
||||
import { ICircularList } from 'common/Types';
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { Disposable } from 'common/Lifecycle';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export interface IInsertEvent {
|
||||
index: number;
|
||||
@@ -26,11 +26,11 @@ export class CircularList<T> extends Disposable implements ICircularList<T> {
|
||||
private _startIndex: number;
|
||||
private _length: number;
|
||||
|
||||
public readonly onDeleteEmitter = this.register(new EventEmitter<IDeleteEvent>());
|
||||
public readonly onDeleteEmitter = this.register(new Emitter<IDeleteEvent>());
|
||||
public readonly onDelete = this.onDeleteEmitter.event;
|
||||
public readonly onInsertEmitter = this.register(new EventEmitter<IInsertEvent>());
|
||||
public readonly onInsertEmitter = this.register(new Emitter<IInsertEvent>());
|
||||
public readonly onInsert = this.onInsertEmitter.event;
|
||||
public readonly onTrimEmitter = this.register(new EventEmitter<number>());
|
||||
public readonly onTrimEmitter = this.register(new Emitter<number>());
|
||||
public readonly onTrim = this.onTrimEmitter.event;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -39,6 +39,7 @@ import { IBufferSet } from 'common/buffer/Types';
|
||||
import { InputHandler } from 'common/InputHandler';
|
||||
import { WriteBuffer } from 'common/input/WriteBuffer';
|
||||
import { OscLinkService } from 'common/services/OscLinkService';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
// Only trigger this warning a single time per session
|
||||
let hasWriteSyncWarnHappened = false;
|
||||
@@ -59,15 +60,15 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
||||
private _writeBuffer: WriteBuffer;
|
||||
private _windowsWrappingHeuristics = this.register(new MutableDisposable());
|
||||
|
||||
private readonly _onBinary = this.register(new EventEmitter<string>());
|
||||
private readonly _onBinary = this.register(new Emitter<string>());
|
||||
public readonly onBinary = this._onBinary.event;
|
||||
private readonly _onData = this.register(new EventEmitter<string>());
|
||||
private readonly _onData = this.register(new Emitter<string>());
|
||||
public readonly onData = this._onData.event;
|
||||
protected _onLineFeed = this.register(new EventEmitter<void>());
|
||||
protected _onLineFeed = this.register(new Emitter<void>());
|
||||
public readonly onLineFeed = this._onLineFeed.event;
|
||||
private readonly _onResize = this.register(new EventEmitter<{ cols: number, rows: number }>());
|
||||
private readonly _onResize = this.register(new Emitter<{ cols: number, rows: number }>());
|
||||
public readonly onResize = this._onResize.event;
|
||||
protected readonly _onWriteParsed = this.register(new EventEmitter<void>());
|
||||
protected readonly _onWriteParsed = this.register(new Emitter<void>());
|
||||
public readonly onWriteParsed = this._onWriteParsed.event;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
*/
|
||||
|
||||
import { assert } from 'chai';
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
describe('EventEmitter', () => {
|
||||
it('should fire listeners multiple times', () => {
|
||||
const order: string[] = [];
|
||||
const emitter = new EventEmitter<number>();
|
||||
const emitter = new Emitter<number>();
|
||||
emitter.event(data => order.push(data + 'a'));
|
||||
emitter.event(data => order.push(data + 'b'));
|
||||
emitter.fire(1);
|
||||
@@ -19,7 +19,7 @@ describe('EventEmitter', () => {
|
||||
|
||||
it('should not fire listeners once disposed', () => {
|
||||
const order: string[] = [];
|
||||
const emitter = new EventEmitter<number>();
|
||||
const emitter = new Emitter<number>();
|
||||
emitter.event(data => order.push(data + 'a'));
|
||||
const disposeB = emitter.event(data => order.push(data + 'b'));
|
||||
emitter.event(data => order.push(data + 'c'));
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
import { IDisposable } from 'common/Types';
|
||||
import type { Emitter, Event } from 'vs/base/common/event';
|
||||
|
||||
interface IListener<T, U = void> {
|
||||
(arg1: T, arg2: U): void;
|
||||
@@ -18,7 +19,7 @@ export interface IEventEmitter<T, U = void> {
|
||||
fire(arg1: T, arg2: U): void;
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
/** @deprecated Use vs/base/common/events version */
|
||||
export class EventEmitter<T, U = void> implements IEventEmitter<T, U> {
|
||||
private _listeners: Set<IListener<T, U>> = new Set();
|
||||
private _event?: IEvent<T, U>;
|
||||
@@ -63,10 +64,11 @@ export class EventEmitter<T, U = void> implements IEventEmitter<T, U> {
|
||||
}
|
||||
}
|
||||
|
||||
export function forwardEvent<T>(from: IEvent<T>, to: IEventEmitter<T>): IDisposable {
|
||||
export function forwardEvent<T>(from: IEvent<T> | Event<T>, to: Emitter<T>): IDisposable {
|
||||
return from(e => to.fire(e));
|
||||
}
|
||||
|
||||
/** @deprecated Use vs/base/common/events version */
|
||||
export function runAndSubscribe<T>(event: IEvent<T>, handler: (e: T | undefined) => any): IDisposable {
|
||||
handler(undefined);
|
||||
return event(e => handler(e));
|
||||
|
||||
+13
-12
@@ -22,6 +22,7 @@ import { OscHandler } from 'common/parser/OscParser';
|
||||
import { DcsHandler } from 'common/parser/DcsParser';
|
||||
import { IBuffer } from 'common/buffer/Types';
|
||||
import { parseColor } from 'common/input/XParseColor';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
/**
|
||||
* Map collect to glevel. Used in `selectCharset`.
|
||||
@@ -132,32 +133,32 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
|
||||
private _activeBuffer: IBuffer;
|
||||
|
||||
private readonly _onRequestBell = this.register(new EventEmitter<void>());
|
||||
private readonly _onRequestBell = this.register(new Emitter<void>());
|
||||
public readonly onRequestBell = this._onRequestBell.event;
|
||||
private readonly _onRequestRefreshRows = this.register(new EventEmitter<number, number>());
|
||||
public readonly onRequestRefreshRows = this._onRequestRefreshRows.event;
|
||||
private readonly _onRequestReset = this.register(new EventEmitter<void>());
|
||||
private readonly _onRequestReset = this.register(new Emitter<void>());
|
||||
public readonly onRequestReset = this._onRequestReset.event;
|
||||
private readonly _onRequestSendFocus = this.register(new EventEmitter<void>());
|
||||
private readonly _onRequestSendFocus = this.register(new Emitter<void>());
|
||||
public readonly onRequestSendFocus = this._onRequestSendFocus.event;
|
||||
private readonly _onRequestSyncScrollBar = this.register(new EventEmitter<void>());
|
||||
private readonly _onRequestSyncScrollBar = this.register(new Emitter<void>());
|
||||
public readonly onRequestSyncScrollBar = this._onRequestSyncScrollBar.event;
|
||||
private readonly _onRequestWindowsOptionsReport = this.register(new EventEmitter<WindowsOptionsReportType>());
|
||||
private readonly _onRequestWindowsOptionsReport = this.register(new Emitter<WindowsOptionsReportType>());
|
||||
public readonly onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event;
|
||||
|
||||
private readonly _onA11yChar = this.register(new EventEmitter<string>());
|
||||
private readonly _onA11yChar = this.register(new Emitter<string>());
|
||||
public readonly onA11yChar = this._onA11yChar.event;
|
||||
private readonly _onA11yTab = this.register(new EventEmitter<number>());
|
||||
private readonly _onA11yTab = this.register(new Emitter<number>());
|
||||
public readonly onA11yTab = this._onA11yTab.event;
|
||||
private readonly _onCursorMove = this.register(new EventEmitter<void>());
|
||||
private readonly _onCursorMove = this.register(new Emitter<void>());
|
||||
public readonly onCursorMove = this._onCursorMove.event;
|
||||
private readonly _onLineFeed = this.register(new EventEmitter<void>());
|
||||
private readonly _onLineFeed = this.register(new Emitter<void>());
|
||||
public readonly onLineFeed = this._onLineFeed.event;
|
||||
private readonly _onScroll = this.register(new EventEmitter<number>());
|
||||
private readonly _onScroll = this.register(new Emitter<number>());
|
||||
public readonly onScroll = this._onScroll.event;
|
||||
private readonly _onTitleChange = this.register(new EventEmitter<string>());
|
||||
private readonly _onTitleChange = this.register(new Emitter<string>());
|
||||
public readonly onTitleChange = this._onTitleChange.event;
|
||||
private readonly _onColor = this.register(new EventEmitter<IColorEvent>());
|
||||
private readonly _onColor = this.register(new Emitter<IColorEvent>());
|
||||
public readonly onColor = this._onColor.event;
|
||||
|
||||
private _parseStack: IParseStack = {
|
||||
|
||||
@@ -13,13 +13,14 @@ import { BufferSet } from 'common/buffer/BufferSet';
|
||||
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEventType, ICharset, IModes, IAttributeData, IOscLinkData, IDisposable } from 'common/Types';
|
||||
import { UnicodeV6 } from 'common/input/UnicodeV6';
|
||||
import { IDecorationOptions, IDecoration } from '@xterm/xterm';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export class MockBufferService implements IBufferService {
|
||||
public serviceBrand: any;
|
||||
public get buffer(): IBuffer { return this.buffers.active; }
|
||||
public buffers: IBufferSet = {} as any;
|
||||
public onResize: IEvent<{ cols: number, rows: number }> = new EventEmitter<{ cols: number, rows: number }>().event;
|
||||
public onScroll: IEvent<number> = new EventEmitter<number>().event;
|
||||
public onScroll: IEvent<number> = new Emitter<number>().event;
|
||||
public isUserScrolling: boolean = false;
|
||||
constructor(
|
||||
public cols: number,
|
||||
@@ -62,7 +63,7 @@ export class MockCoreMouseService implements ICoreMouseService {
|
||||
public addProtocol(name: string): void { }
|
||||
public reset(): void { }
|
||||
public triggerMouseEvent(event: ICoreMouseEvent): boolean { return false; }
|
||||
public onProtocolChange: IEvent<CoreMouseEventType> = new EventEmitter<CoreMouseEventType>().event;
|
||||
public onProtocolChange: IEvent<CoreMouseEventType> = new Emitter<CoreMouseEventType>().event;
|
||||
public explainEvents(events: CoreMouseEventType): { [event: string]: boolean } {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
@@ -94,10 +95,10 @@ export class MockCoreService implements ICoreService {
|
||||
sendFocus: false,
|
||||
wraparound: true
|
||||
};
|
||||
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 onRequestScrollToBottom: IEvent<void> = new EventEmitter<void>().event;
|
||||
public onData: IEvent<string> = new Emitter<string>().event;
|
||||
public onUserInput: IEvent<void> = new Emitter<void>().event;
|
||||
public onBinary: IEvent<string> = new Emitter<string>().event;
|
||||
public onRequestScrollToBottom: IEvent<void> = new Emitter<void>().event;
|
||||
public reset(): void { }
|
||||
public triggerDataEvent(data: string, wasUserInput?: boolean): void { }
|
||||
public triggerBinaryEvent(data: string): void { }
|
||||
@@ -117,7 +118,7 @@ export class MockOptionsService implements IOptionsService {
|
||||
public serviceBrand: any;
|
||||
public readonly rawOptions: Required<ITerminalOptions> = clone(DEFAULT_OPTIONS);
|
||||
public options: Required<ITerminalOptions> = this.rawOptions;
|
||||
public onOptionChange: IEvent<keyof ITerminalOptions> = new EventEmitter<keyof ITerminalOptions>().event;
|
||||
public onOptionChange: IEvent<keyof ITerminalOptions> = new Emitter<keyof ITerminalOptions>().event;
|
||||
constructor(testOptions?: Partial<ITerminalOptions>) {
|
||||
if (testOptions) {
|
||||
for (const key of Object.keys(testOptions)) {
|
||||
@@ -169,7 +170,7 @@ export class MockUnicodeService implements IUnicodeService {
|
||||
}
|
||||
public versions: string[] = [];
|
||||
public activeVersion: string = '';
|
||||
public onChange: IEvent<string> = new EventEmitter<string>().event;
|
||||
public onChange: IEvent<string> = new Emitter<string>().event;
|
||||
public wcwidth = (codepoint: number): UnicodeCharWidth => this._provider.wcwidth(codepoint);
|
||||
public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {
|
||||
let width = this.wcwidth(codepoint);
|
||||
@@ -192,8 +193,8 @@ export class MockUnicodeService implements IUnicodeService {
|
||||
export class MockDecorationService implements IDecorationService {
|
||||
public serviceBrand: any;
|
||||
public get decorations(): IterableIterator<IInternalDecoration> { return [].values(); }
|
||||
public onDecorationRegistered = new EventEmitter<IInternalDecoration>().event;
|
||||
public onDecorationRemoved = new EventEmitter<IInternalDecoration>().event;
|
||||
public onDecorationRegistered = new Emitter<IInternalDecoration>().event;
|
||||
public onDecorationRemoved = new Emitter<IInternalDecoration>().event;
|
||||
public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined { return undefined; }
|
||||
public reset(): void { }
|
||||
public forEachDecorationAtCell(x: number, line: number, layer: 'bottom' | 'top' | undefined, callback: (decoration: IInternalDecoration) => void): void { }
|
||||
|
||||
+5
-4
@@ -4,12 +4,13 @@
|
||||
*/
|
||||
|
||||
import { IDeleteEvent, IInsertEvent } from 'common/CircularList';
|
||||
import { IEvent, IEventEmitter } from 'common/EventEmitter';
|
||||
import { IEvent } from 'common/EventEmitter';
|
||||
import { Attributes, UnderlineStyle } from 'common/buffer/Constants'; // eslint-disable-line no-unused-vars
|
||||
import { IBufferSet } from 'common/buffer/Types';
|
||||
import { IParams } from 'common/parser/Types';
|
||||
import { ICoreMouseService, ICoreService, IOptionsService, IUnicodeService } from 'common/services/Services';
|
||||
import { IFunctionIdentifier, ITerminalOptions as IPublicTerminalOptions } from '@xterm/xterm';
|
||||
import type { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export interface ICoreTerminal {
|
||||
coreMouseService: ICoreMouseService;
|
||||
@@ -67,11 +68,11 @@ export interface ICircularList<T> {
|
||||
maxLength: number;
|
||||
isFull: boolean;
|
||||
|
||||
onDeleteEmitter: IEventEmitter<IDeleteEvent>;
|
||||
onDeleteEmitter: Emitter<IDeleteEvent>;
|
||||
onDelete: IEvent<IDeleteEvent>;
|
||||
onInsertEmitter: IEventEmitter<IInsertEvent>;
|
||||
onInsertEmitter: Emitter<IInsertEvent>;
|
||||
onInsert: IEvent<IInsertEvent>;
|
||||
onTrimEmitter: IEventEmitter<number>;
|
||||
onTrimEmitter: Emitter<number>;
|
||||
onTrim: IEvent<number>;
|
||||
|
||||
get(index: number): T | undefined;
|
||||
|
||||
@@ -161,6 +161,10 @@ export class Buffer implements IBuffer {
|
||||
this.lines.maxLength = newMaxLength;
|
||||
}
|
||||
|
||||
// if (this._cols > newCols) {
|
||||
// console.log('increase!');
|
||||
// }
|
||||
|
||||
// The following adjustments should only happen if the buffer has been
|
||||
// initialized/filled.
|
||||
if (this.lines.length > 0) {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { disposeArray } from 'common/Lifecycle';
|
||||
import { IDisposable, IMarker } from 'common/Types';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export class Marker implements IMarker {
|
||||
private static _nextId = 1;
|
||||
@@ -16,7 +16,7 @@ export class Marker implements IMarker {
|
||||
private readonly _id: number = Marker._nextId++;
|
||||
public get id(): number { return this._id; }
|
||||
|
||||
private readonly _onDispose = this.register(new EventEmitter<void>());
|
||||
private readonly _onDispose = this.register(new Emitter<void>());
|
||||
public readonly onDispose = this._onDispose.event;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { Disposable } from 'common/Lifecycle';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
declare const setTimeout: (handler: () => void, timeout?: number) => void;
|
||||
|
||||
@@ -43,7 +43,7 @@ export class WriteBuffer extends Disposable {
|
||||
private _syncCalls = 0;
|
||||
private _didUserInput = false;
|
||||
|
||||
private readonly _onWriteParsed = this.register(new EventEmitter<void>());
|
||||
private readonly _onWriteParsed = this.register(new Emitter<void>());
|
||||
public readonly onWriteParsed = this._onWriteParsed.event;
|
||||
|
||||
constructor(private _action: (data: string | Uint8Array, promiseResult?: boolean) => void | Promise<boolean>) {
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
|
||||
import { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from '@xterm/xterm';
|
||||
import { BufferApiView } from 'common/public/BufferApiView';
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { ICoreTerminal } from 'common/Types';
|
||||
import { Disposable } from 'common/Lifecycle';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export class BufferNamespaceApi extends Disposable implements IBufferNamespaceApi {
|
||||
private _normal: BufferApiView;
|
||||
private _alternate: BufferApiView;
|
||||
|
||||
private readonly _onBufferChange = this.register(new EventEmitter<IBufferApi>());
|
||||
private readonly _onBufferChange = this.register(new Emitter<IBufferApi>());
|
||||
public readonly onBufferChange = this._onBufferChange.event;
|
||||
|
||||
constructor(private _core: ICoreTerminal) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import { IAttributeData, IBufferLine } from 'common/Types';
|
||||
import { BufferSet } from 'common/buffer/BufferSet';
|
||||
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
||||
import { IBufferService, IOptionsService } from 'common/services/Services';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars
|
||||
export const MINIMUM_ROWS = 1;
|
||||
@@ -24,7 +25,7 @@ export class BufferService extends Disposable implements IBufferService {
|
||||
|
||||
private readonly _onResize = this.register(new EventEmitter<{ cols: number, rows: number }>());
|
||||
public readonly onResize = this._onResize.event;
|
||||
private readonly _onScroll = this.register(new EventEmitter<number>());
|
||||
private readonly _onScroll = this.register(new Emitter<number>());
|
||||
public readonly onScroll = this._onScroll.event;
|
||||
|
||||
public get buffer(): IBuffer { return this.buffers.active; }
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* @license MIT
|
||||
*/
|
||||
import { IBufferService, ICoreService, ICoreMouseService } from 'common/services/Services';
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { ICoreMouseProtocol, ICoreMouseEvent, CoreMouseEncoding, CoreMouseEventType, CoreMouseButton, CoreMouseAction } from 'common/Types';
|
||||
import { Disposable } from 'common/Lifecycle';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
/**
|
||||
* Supported default protocols.
|
||||
@@ -175,7 +175,7 @@ export class CoreMouseService extends Disposable implements ICoreMouseService {
|
||||
private _activeEncoding: string = '';
|
||||
private _lastEvent: ICoreMouseEvent | null = null;
|
||||
|
||||
private readonly _onProtocolChange = this.register(new EventEmitter<CoreMouseEventType>());
|
||||
private readonly _onProtocolChange = this.register(new Emitter<CoreMouseEventType>());
|
||||
public readonly onProtocolChange = this._onProtocolChange.event;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
*/
|
||||
|
||||
import { clone } from 'common/Clone';
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { Disposable } from 'common/Lifecycle';
|
||||
import { IDecPrivateModes, IModes } from 'common/Types';
|
||||
import { IBufferService, ICoreService, ILogService, IOptionsService } from 'common/services/Services';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
const DEFAULT_MODES: IModes = Object.freeze({
|
||||
insertMode: false
|
||||
@@ -31,13 +31,13 @@ export class CoreService extends Disposable implements ICoreService {
|
||||
public modes: IModes;
|
||||
public decPrivateModes: IDecPrivateModes;
|
||||
|
||||
private readonly _onData = this.register(new EventEmitter<string>());
|
||||
private readonly _onData = this.register(new Emitter<string>());
|
||||
public readonly onData = this._onData.event;
|
||||
private readonly _onUserInput = this.register(new EventEmitter<void>());
|
||||
private readonly _onUserInput = this.register(new Emitter<void>());
|
||||
public readonly onUserInput = this._onUserInput.event;
|
||||
private readonly _onBinary = this.register(new EventEmitter<string>());
|
||||
private readonly _onBinary = this.register(new Emitter<string>());
|
||||
public readonly onBinary = this._onBinary.event;
|
||||
private readonly _onRequestScrollToBottom = this.register(new EventEmitter<void>());
|
||||
private readonly _onRequestScrollToBottom = this.register(new Emitter<void>());
|
||||
public readonly onRequestScrollToBottom = this._onRequestScrollToBottom.event;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
|
||||
import { assert } from 'chai';
|
||||
import { DecorationService } from './DecorationService';
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { IMarker } from 'common/Types';
|
||||
import { Disposable } from 'common/Lifecycle';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
const fakeMarker: IMarker = Object.freeze(new class extends Disposable {
|
||||
public readonly id = 1;
|
||||
public readonly line = 1;
|
||||
public readonly isDisposed = false;
|
||||
public readonly onDispose = new EventEmitter<void>().event;
|
||||
public readonly onDispose = new Emitter<void>().event;
|
||||
}());
|
||||
|
||||
describe('DecorationService', () => {
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
*/
|
||||
|
||||
import { css } from 'common/Color';
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { Disposable, toDisposable } from 'common/Lifecycle';
|
||||
import { IDecorationService, IInternalDecoration } from 'common/services/Services';
|
||||
import { SortedList } from 'common/SortedList';
|
||||
import { IColor } from 'common/Types';
|
||||
import { IDecoration, IDecorationOptions, IMarker } from '@xterm/xterm';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
// Work variables to avoid garbage collection
|
||||
let $xmin = 0;
|
||||
@@ -25,9 +25,9 @@ export class DecorationService extends Disposable implements IDecorationService
|
||||
*/
|
||||
private readonly _decorations: SortedList<IInternalDecoration> = new SortedList(e => e?.marker.line);
|
||||
|
||||
private readonly _onDecorationRegistered = this.register(new EventEmitter<IInternalDecoration>());
|
||||
private readonly _onDecorationRegistered = this.register(new Emitter<IInternalDecoration>());
|
||||
public readonly onDecorationRegistered = this._onDecorationRegistered.event;
|
||||
private readonly _onDecorationRemoved = this.register(new EventEmitter<IInternalDecoration>());
|
||||
private readonly _onDecorationRemoved = this.register(new Emitter<IInternalDecoration>());
|
||||
public readonly onDecorationRemoved = this._onDecorationRemoved.event;
|
||||
|
||||
public get decorations(): IterableIterator<IInternalDecoration> { return this._decorations.values(); }
|
||||
@@ -95,9 +95,9 @@ class Decoration extends Disposable implements IInternalDecoration {
|
||||
public element: HTMLElement | undefined;
|
||||
public get isDisposed(): boolean { return this._isDisposed; }
|
||||
|
||||
public readonly onRenderEmitter = this.register(new EventEmitter<HTMLElement>());
|
||||
public readonly onRenderEmitter = this.register(new Emitter<HTMLElement>());
|
||||
public readonly onRender = this.onRenderEmitter.event;
|
||||
private readonly _onDispose = this.register(new EventEmitter<void>());
|
||||
private readonly _onDispose = this.register(new Emitter<void>());
|
||||
public readonly onDispose = this._onDispose.event;
|
||||
|
||||
private _cachedBg: IColor | undefined | null = null;
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { Disposable, toDisposable } from 'common/Lifecycle';
|
||||
import { isMac } from 'common/Platform';
|
||||
import { CursorStyle, IDisposable } from 'common/Types';
|
||||
import { FontWeight, IOptionsService, ITerminalOptions } from 'common/services/Services';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
|
||||
cols: 80,
|
||||
@@ -65,7 +65,7 @@ export class OptionsService extends Disposable implements IOptionsService {
|
||||
public readonly rawOptions: Required<ITerminalOptions>;
|
||||
public options: Required<ITerminalOptions>;
|
||||
|
||||
private readonly _onOptionChange = this.register(new EventEmitter<keyof ITerminalOptions>());
|
||||
private readonly _onOptionChange = this.register(new Emitter<keyof ITerminalOptions>());
|
||||
public readonly onOptionChange = this._onOptionChange.event;
|
||||
|
||||
constructor(options: Partial<ITerminalOptions>) {
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
*/
|
||||
|
||||
import { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty } from '@xterm/xterm';
|
||||
import { IEvent, IEventEmitter } from 'common/EventEmitter';
|
||||
import { IEvent } from 'common/EventEmitter';
|
||||
import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IModes, IOscLinkData, IWindowOptions } from 'common/Types';
|
||||
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
||||
import { createDecorator } from 'common/services/ServiceRegistry';
|
||||
import type { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export const IBufferService = createDecorator<IBufferService>('BufferService');
|
||||
export interface IBufferService {
|
||||
@@ -377,5 +378,5 @@ export interface IInternalDecoration extends IDecoration {
|
||||
readonly options: IDecorationOptions;
|
||||
readonly backgroundColorRGB: IColor | undefined;
|
||||
readonly foregroundColorRGB: IColor | undefined;
|
||||
readonly onRenderEmitter: IEventEmitter<HTMLElement>;
|
||||
readonly onRenderEmitter: Emitter<HTMLElement>;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { UnicodeV6 } from 'common/input/UnicodeV6';
|
||||
import { IUnicodeService, IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export class UnicodeService implements IUnicodeService {
|
||||
public serviceBrand: any;
|
||||
@@ -14,7 +14,7 @@ export class UnicodeService implements IUnicodeService {
|
||||
private _active: string = '';
|
||||
private _activeProvider: IUnicodeVersionProvider;
|
||||
|
||||
private readonly _onChange = new EventEmitter<string>();
|
||||
private readonly _onChange = new Emitter<string>();
|
||||
public readonly onChange = this._onChange.event;
|
||||
|
||||
public static extractShouldJoin(value: UnicodeCharProperties): boolean {
|
||||
|
||||
@@ -9,10 +9,16 @@
|
||||
"types": [
|
||||
"../../node_modules/@types/mocha"
|
||||
],
|
||||
"baseUrl": ".."
|
||||
"baseUrl": "..",
|
||||
"paths": {
|
||||
"vs/*": [ "./vs/*" ]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"./**/*",
|
||||
"../../typings/xterm.d.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../vs" }
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user