Migrate most EventEmitter to base/ Emitter
This commit is contained in:
@@ -12,7 +12,7 @@ import { allowRescaling, throwIfFalsy } from 'browser/renderer/shared/RendererUt
|
||||
import { createSelectionRenderModel } from 'browser/renderer/shared/SelectionRenderModel';
|
||||
import { IRasterizedGlyph, IRenderDimensions, ISelectionRenderModel, ITextureAtlas } from 'browser/renderer/shared/Types';
|
||||
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
|
||||
import { EventEmitter, forwardEvent } from 'common/EventEmitter';
|
||||
import { forwardEvent } from 'common/EventEmitter';
|
||||
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
|
||||
import { isSafari } from 'common/Platform';
|
||||
import { ICellData } from 'common/Types';
|
||||
@@ -21,6 +21,7 @@ import { WHITESPACE_CELL_CODE } from 'common/buffer/Constants';
|
||||
import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';
|
||||
import { Terminal } from '@xterm/xterm';
|
||||
import { IRenderLayer } from './Types';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export abstract class BaseRenderLayer extends Disposable implements IRenderLayer {
|
||||
private _canvas: HTMLCanvasElement;
|
||||
@@ -42,7 +43,7 @@ export abstract class BaseRenderLayer extends Disposable implements IRenderLayer
|
||||
public get canvas(): HTMLCanvasElement { return this._canvas; }
|
||||
public get cacheCanvas(): HTMLCanvasElement { return this._charAtlas?.pages[0].canvas!; }
|
||||
|
||||
private readonly _onAddTextureAtlasCanvas = this.register(new EventEmitter<HTMLCanvasElement>());
|
||||
private readonly _onAddTextureAtlasCanvas = this.register(new Emitter<HTMLCanvasElement>());
|
||||
public readonly onAddTextureAtlasCanvas = this._onAddTextureAtlasCanvas.event;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -7,19 +7,20 @@ import type { ITerminalAddon, Terminal } from '@xterm/xterm';
|
||||
import type { CanvasAddon as ICanvasApi } from '@xterm/addon-canvas';
|
||||
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
|
||||
import { ITerminal } from 'browser/Types';
|
||||
import { EventEmitter, forwardEvent } from 'common/EventEmitter';
|
||||
import { forwardEvent } from 'common/EventEmitter';
|
||||
import { Disposable, toDisposable } from 'common/Lifecycle';
|
||||
import { setTraceLogger } from 'common/services/LogService';
|
||||
import { IBufferService, IDecorationService, ILogService } from 'common/services/Services';
|
||||
import { CanvasRenderer } from './CanvasRenderer';
|
||||
import { Emitter } from '../../../src/vs/base/common/event';
|
||||
|
||||
export class CanvasAddon extends Disposable implements ITerminalAddon , ICanvasApi {
|
||||
private _terminal?: Terminal;
|
||||
private _renderer?: CanvasRenderer;
|
||||
|
||||
private readonly _onChangeTextureAtlas = this.register(new EventEmitter<HTMLCanvasElement>());
|
||||
private readonly _onChangeTextureAtlas = this.register(new Emitter<HTMLCanvasElement>());
|
||||
public readonly onChangeTextureAtlas = this._onChangeTextureAtlas.event;
|
||||
private readonly _onAddTextureAtlasCanvas = this.register(new EventEmitter<HTMLCanvasElement>());
|
||||
private readonly _onAddTextureAtlasCanvas = this.register(new Emitter<HTMLCanvasElement>());
|
||||
public readonly onAddTextureAtlasCanvas = this._onAddTextureAtlasCanvas.event;
|
||||
|
||||
public get textureAtlas(): HTMLCanvasElement | undefined {
|
||||
|
||||
@@ -9,7 +9,7 @@ import { observeDevicePixelDimensions } from 'browser/renderer/shared/DevicePixe
|
||||
import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
|
||||
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/shared/Types';
|
||||
import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
|
||||
import { EventEmitter, forwardEvent } from 'common/EventEmitter';
|
||||
import { forwardEvent } from 'common/EventEmitter';
|
||||
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
|
||||
import { IBufferService, ICoreService, IDecorationService, IOptionsService } from 'common/services/Services';
|
||||
import { Terminal } from '@xterm/xterm';
|
||||
@@ -18,6 +18,7 @@ import { LinkRenderLayer } from './LinkRenderLayer';
|
||||
import { SelectionRenderLayer } from './SelectionRenderLayer';
|
||||
import { TextRenderLayer } from './TextRenderLayer';
|
||||
import { IRenderLayer } from './Types';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export class CanvasRenderer extends Disposable implements IRenderer {
|
||||
private _renderLayers: IRenderLayer[];
|
||||
@@ -26,11 +27,11 @@ export class CanvasRenderer extends Disposable implements IRenderer {
|
||||
|
||||
public dimensions: IRenderDimensions;
|
||||
|
||||
private readonly _onRequestRedraw = this.register(new EventEmitter<IRequestRedrawEvent>());
|
||||
private readonly _onRequestRedraw = this.register(new Emitter<IRequestRedrawEvent>());
|
||||
public readonly onRequestRedraw = this._onRequestRedraw.event;
|
||||
private readonly _onChangeTextureAtlas = this.register(new EventEmitter<HTMLCanvasElement>());
|
||||
private readonly _onChangeTextureAtlas = this.register(new Emitter<HTMLCanvasElement>());
|
||||
public readonly onChangeTextureAtlas = this._onChangeTextureAtlas.event;
|
||||
private readonly _onAddTextureAtlasCanvas = this.register(new EventEmitter<HTMLCanvasElement>());
|
||||
private readonly _onAddTextureAtlasCanvas = this.register(new Emitter<HTMLCanvasElement>());
|
||||
public readonly onAddTextureAtlasCanvas = this._onAddTextureAtlasCanvas.event;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
"browser/*": [
|
||||
"../../../src/browser/*"
|
||||
],
|
||||
"vs/*": [
|
||||
"../../../src/vs/*"
|
||||
],
|
||||
"@xterm/addon-canvas": [
|
||||
"../typings/addon-canvas.d.ts"
|
||||
]
|
||||
@@ -38,6 +41,9 @@
|
||||
},
|
||||
{
|
||||
"path": "../../../src/browser"
|
||||
},
|
||||
{
|
||||
"path": "../../../src/vs"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -7,25 +7,26 @@ import type { ITerminalAddon, Terminal } from '@xterm/xterm';
|
||||
import type { WebglAddon as IWebglApi } from '@xterm/addon-webgl';
|
||||
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
|
||||
import { ITerminal } from 'browser/Types';
|
||||
import { EventEmitter, forwardEvent } from 'common/EventEmitter';
|
||||
import { forwardEvent } from 'common/EventEmitter';
|
||||
import { Disposable, toDisposable } from 'common/Lifecycle';
|
||||
import { getSafariVersion, isSafari } from 'common/Platform';
|
||||
import { ICoreService, IDecorationService, ILogService, IOptionsService } from 'common/services/Services';
|
||||
import { IWebGL2RenderingContext } from './Types';
|
||||
import { WebglRenderer } from './WebglRenderer';
|
||||
import { setTraceLogger } from 'common/services/LogService';
|
||||
import { Emitter } from '../../../src/vs/base/common/event';
|
||||
|
||||
export class WebglAddon extends Disposable implements ITerminalAddon , IWebglApi {
|
||||
private _terminal?: Terminal;
|
||||
private _renderer?: WebglRenderer;
|
||||
|
||||
private readonly _onChangeTextureAtlas = this.register(new EventEmitter<HTMLCanvasElement>());
|
||||
private readonly _onChangeTextureAtlas = this.register(new Emitter<HTMLCanvasElement>());
|
||||
public readonly onChangeTextureAtlas = this._onChangeTextureAtlas.event;
|
||||
private readonly _onAddTextureAtlasCanvas = this.register(new EventEmitter<HTMLCanvasElement>());
|
||||
private readonly _onAddTextureAtlasCanvas = this.register(new Emitter<HTMLCanvasElement>());
|
||||
public readonly onAddTextureAtlasCanvas = this._onAddTextureAtlasCanvas.event;
|
||||
private readonly _onRemoveTextureAtlasCanvas = this.register(new EventEmitter<HTMLCanvasElement>());
|
||||
private readonly _onRemoveTextureAtlasCanvas = this.register(new Emitter<HTMLCanvasElement>());
|
||||
public readonly onRemoveTextureAtlasCanvas = this._onRemoveTextureAtlasCanvas.event;
|
||||
private readonly _onContextLoss = this.register(new EventEmitter<void>());
|
||||
private readonly _onContextLoss = this.register(new Emitter<void>());
|
||||
public readonly onContextLoss = this._onContextLoss.event;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -12,7 +12,7 @@ import { observeDevicePixelDimensions } from 'browser/renderer/shared/DevicePixe
|
||||
import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
|
||||
import { IRenderDimensions, IRenderer, IRequestRedrawEvent, ITextureAtlas } from 'browser/renderer/shared/Types';
|
||||
import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
|
||||
import { EventEmitter, forwardEvent } from 'common/EventEmitter';
|
||||
import { forwardEvent } from 'common/EventEmitter';
|
||||
import { Disposable, MutableDisposable, getDisposeArrayDisposable, toDisposable } from 'common/Lifecycle';
|
||||
import { CharData, IBufferLine, ICellData } from 'common/Types';
|
||||
import { AttributeData } from 'common/buffer/AttributeData';
|
||||
@@ -26,6 +26,7 @@ import { COMBINED_CHAR_BIT_MASK, RENDER_MODEL_BG_OFFSET, RENDER_MODEL_EXT_OFFSET
|
||||
import { IWebGL2RenderingContext } from './Types';
|
||||
import { LinkRenderLayer } from './renderLayer/LinkRenderLayer';
|
||||
import { IRenderLayer } from './renderLayer/Types';
|
||||
import { Emitter } from '../../../src/vs/base/common/event';
|
||||
|
||||
export class WebglRenderer extends Disposable implements IRenderer {
|
||||
private _renderLayers: IRenderLayer[];
|
||||
@@ -51,15 +52,15 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
||||
private _isAttached: boolean;
|
||||
private _contextRestorationTimeout: number | undefined;
|
||||
|
||||
private readonly _onChangeTextureAtlas = this.register(new EventEmitter<HTMLCanvasElement>());
|
||||
private readonly _onChangeTextureAtlas = this.register(new Emitter<HTMLCanvasElement>());
|
||||
public readonly onChangeTextureAtlas = this._onChangeTextureAtlas.event;
|
||||
private readonly _onAddTextureAtlasCanvas = this.register(new EventEmitter<HTMLCanvasElement>());
|
||||
private readonly _onAddTextureAtlasCanvas = this.register(new Emitter<HTMLCanvasElement>());
|
||||
public readonly onAddTextureAtlasCanvas = this._onAddTextureAtlasCanvas.event;
|
||||
private readonly _onRemoveTextureAtlasCanvas = this.register(new EventEmitter<HTMLCanvasElement>());
|
||||
private readonly _onRemoveTextureAtlasCanvas = this.register(new Emitter<HTMLCanvasElement>());
|
||||
public readonly onRemoveTextureAtlasCanvas = this._onRemoveTextureAtlasCanvas.event;
|
||||
private readonly _onRequestRedraw = this.register(new EventEmitter<IRequestRedrawEvent>());
|
||||
private readonly _onRequestRedraw = this.register(new Emitter<IRequestRedrawEvent>());
|
||||
public readonly onRequestRedraw = this._onRequestRedraw.event;
|
||||
private readonly _onContextLoss = this.register(new EventEmitter<void>());
|
||||
private readonly _onContextLoss = this.register(new Emitter<void>());
|
||||
public readonly onContextLoss = this._onContextLoss.event;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
"browser/*": [
|
||||
"../../../src/browser/*"
|
||||
],
|
||||
"vs/*": [
|
||||
"../../../src/vs/*"
|
||||
],
|
||||
"@xterm/addon-webgl": [
|
||||
"../typings/addon-webgl.d.ts"
|
||||
]
|
||||
@@ -39,6 +42,9 @@
|
||||
},
|
||||
{
|
||||
"path": "../../../src/browser"
|
||||
},
|
||||
{
|
||||
"path": "../../../src/vs"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ import { IDecorationService } from 'common/services/Services';
|
||||
import { WindowsOptionsReportType } from '../common/InputHandler';
|
||||
import { AccessibilityManager } from './AccessibilityManager';
|
||||
import { Linkifier } from './Linkifier';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
|
||||
public textarea: HTMLTextAreaElement | undefined;
|
||||
@@ -121,28 +122,28 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
|
||||
private _compositionHelper: ICompositionHelper | undefined;
|
||||
private _accessibilityManager: MutableDisposable<AccessibilityManager> = this.register(new MutableDisposable());
|
||||
|
||||
private readonly _onCursorMove = this.register(new EventEmitter<void>());
|
||||
private readonly _onCursorMove = this.register(new Emitter<void>());
|
||||
public readonly onCursorMove = this._onCursorMove.event;
|
||||
private readonly _onKey = this.register(new EventEmitter<{ key: string, domEvent: KeyboardEvent }>());
|
||||
public readonly onKey = this._onKey.event;
|
||||
private readonly _onRender = this.register(new EventEmitter<{ start: number, end: number }>());
|
||||
public readonly onRender = this._onRender.event;
|
||||
private readonly _onSelectionChange = this.register(new EventEmitter<void>());
|
||||
private readonly _onSelectionChange = this.register(new Emitter<void>());
|
||||
public readonly onSelectionChange = this._onSelectionChange.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 _onBell = this.register(new EventEmitter<void>());
|
||||
private readonly _onBell = this.register(new Emitter<void>());
|
||||
public readonly onBell = this._onBell.event;
|
||||
|
||||
private _onFocus = this.register(new EventEmitter<void>());
|
||||
private _onFocus = this.register(new Emitter<void>());
|
||||
public get onFocus(): IEvent<void> { return this._onFocus.event; }
|
||||
private _onBlur = this.register(new EventEmitter<void>());
|
||||
private _onBlur = this.register(new Emitter<void>());
|
||||
public get onBlur(): IEvent<void> { return this._onBlur.event; }
|
||||
private _onA11yCharEmitter = this.register(new EventEmitter<string>());
|
||||
private _onA11yCharEmitter = this.register(new Emitter<string>());
|
||||
public get onA11yChar(): IEvent<string> { return this._onA11yCharEmitter.event; }
|
||||
private _onA11yTabEmitter = this.register(new EventEmitter<number>());
|
||||
private _onA11yTabEmitter = this.register(new Emitter<number>());
|
||||
public get onA11yTab(): IEvent<number> { return this._onA11yTabEmitter.event; }
|
||||
private _onWillOpen = this.register(new EventEmitter<HTMLElement>());
|
||||
private _onWillOpen = this.register(new Emitter<HTMLElement>());
|
||||
public get onWillOpen(): IEvent<HTMLElement> { return this._onWillOpen.event; }
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
import { addDisposableDomListener } from 'browser/Lifecycle';
|
||||
import { IBufferCellPosition, ILink, ILinkDecorations, ILinkWithState, ILinkifier2, ILinkifierEvent } from 'browser/Types';
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { Disposable, disposeArray, getDisposeArrayDisposable, toDisposable } from 'common/Lifecycle';
|
||||
import { IDisposable } from 'common/Types';
|
||||
import { IBufferService } from 'common/services/Services';
|
||||
import { ILinkProviderService, IMouseService, IRenderService } from './services/Services';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export class Linkifier extends Disposable implements ILinkifier2 {
|
||||
public get currentLink(): ILinkWithState | undefined { return this._currentLink; }
|
||||
@@ -23,9 +23,9 @@ export class Linkifier extends Disposable implements ILinkifier2 {
|
||||
private _activeProviderReplies: Map<Number, ILinkWithState[] | undefined> | undefined;
|
||||
private _activeLine: number = -1;
|
||||
|
||||
private readonly _onShowLinkUnderline = this.register(new EventEmitter<ILinkifierEvent>());
|
||||
private readonly _onShowLinkUnderline = this.register(new Emitter<ILinkifierEvent>());
|
||||
public readonly onShowLinkUnderline = this._onShowLinkUnderline.event;
|
||||
private readonly _onHideLinkUnderline = this.register(new EventEmitter<ILinkifierEvent>());
|
||||
private readonly _onHideLinkUnderline = this.register(new Emitter<ILinkifierEvent>());
|
||||
public readonly onHideLinkUnderline = this._onHideLinkUnderline.event;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -19,6 +19,7 @@ import { AttributeData } from 'common/buffer/AttributeData';
|
||||
import { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';
|
||||
import { css } from 'common/Color';
|
||||
import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export class TestTerminal extends CoreBrowserTerminal {
|
||||
public get curAttrData(): IAttributeData { return (this as any)._inputHandler._curAttrData; }
|
||||
@@ -356,7 +357,7 @@ export class MockCompositionHelper implements ICompositionHelper {
|
||||
}
|
||||
|
||||
export class MockCoreBrowserService implements ICoreBrowserService {
|
||||
public onDprChange = new EventEmitter<number>().event;
|
||||
public onDprChange = new Emitter<number>().event;
|
||||
public onWindowChange = new EventEmitter<Window & typeof globalThis, void>().event;
|
||||
public serviceBrand: undefined;
|
||||
public isFocused: boolean = true;
|
||||
@@ -372,7 +373,7 @@ export class MockCoreBrowserService implements ICoreBrowserService {
|
||||
export class MockCharSizeService implements ICharSizeService {
|
||||
public serviceBrand: undefined;
|
||||
public get hasValidSize(): boolean { return this.width > 0 && this.height > 0; }
|
||||
public onCharSizeChange: IEvent<void> = new EventEmitter<void>().event;
|
||||
public onCharSizeChange: IEvent<void> = new Emitter<void>().event;
|
||||
constructor(public width: number, public height: number) {}
|
||||
public measure(): void {}
|
||||
}
|
||||
@@ -390,7 +391,7 @@ export class MockMouseService implements IMouseService {
|
||||
|
||||
export class MockRenderService implements IRenderService {
|
||||
public serviceBrand: undefined;
|
||||
public onDimensionsChange: IEvent<IRenderDimensions> = new EventEmitter<IRenderDimensions>().event;
|
||||
public onDimensionsChange: IEvent<IRenderDimensions> = new Emitter<IRenderDimensions>().event;
|
||||
public onRenderedViewportChange: IEvent<{ start: number, end: number }, void> = new EventEmitter<{ start: number, end: number }>().event;
|
||||
public onRender: 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;
|
||||
@@ -464,10 +465,10 @@ export class MockSelectionService implements ISelectionService {
|
||||
public hasSelection: boolean = false;
|
||||
public selectionStart: [number, number] | undefined;
|
||||
public selectionEnd: [number, number] | undefined;
|
||||
public onLinuxMouseSelection = new EventEmitter<string>().event;
|
||||
public onRequestRedraw = new EventEmitter<ISelectionRedrawRequestEvent>().event;
|
||||
public onRequestScrollLines = new EventEmitter<ISelectionRequestScrollLinesEvent>().event;
|
||||
public onSelectionChange = new EventEmitter<void>().event;
|
||||
public onLinuxMouseSelection = new Emitter<string>().event;
|
||||
public onRequestRedraw = new Emitter<ISelectionRedrawRequestEvent>().event;
|
||||
public onRequestScrollLines = new Emitter<ISelectionRequestScrollLinesEvent>().event;
|
||||
public onSelectionChange = new Emitter<void>().event;
|
||||
public disable(): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
@@ -511,7 +512,7 @@ export class MockSelectionService implements ISelectionService {
|
||||
|
||||
export class MockThemeService implements IThemeService{
|
||||
public serviceBrand: undefined;
|
||||
public onChangeColors = new EventEmitter<ReadonlyColorSet>().event;
|
||||
public onChangeColors = new Emitter<ReadonlyColorSet>().event;
|
||||
public restoreColor(slot?: ColorIndex | undefined): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
@@ -5,18 +5,19 @@
|
||||
|
||||
import { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
|
||||
import { ViewportConstants } from 'browser/shared/Constants';
|
||||
import { EventEmitter, runAndSubscribe } from 'common/EventEmitter';
|
||||
import { runAndSubscribe } from 'common/EventEmitter';
|
||||
import { Disposable, toDisposable } from 'common/Lifecycle';
|
||||
import { IBufferService, ICoreMouseService, IOptionsService } from 'common/services/Services';
|
||||
import { CoreMouseEventType } from 'common/Types';
|
||||
import { scheduleAtNextAnimationFrame } from 'vs/base/browser/dom';
|
||||
import { SmoothScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
|
||||
import type { ScrollableElementChangeOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { Scrollable, ScrollbarVisibility, type ScrollEvent } from 'vs/base/common/scrollable';
|
||||
|
||||
export class Viewport extends Disposable {
|
||||
|
||||
protected _onRequestScrollLines = this.register(new EventEmitter<number>());
|
||||
protected _onRequestScrollLines = this.register(new Emitter<number>());
|
||||
public readonly onRequestScrollLines = this._onRequestScrollLines.event;
|
||||
|
||||
private _scrollableElement: SmoothScrollableElement;
|
||||
|
||||
@@ -12,9 +12,9 @@ import { IRenderDimensions, IRenderer, IRequestRedrawEvent, ISelectionRenderMode
|
||||
import { ICharSizeService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
|
||||
import { ILinkifier2, ILinkifierEvent, ITerminal, ReadonlyColorSet } from 'browser/Types';
|
||||
import { color } from 'common/Color';
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { Disposable, toDisposable } from 'common/Lifecycle';
|
||||
import { IBufferService, IInstantiationService, IOptionsService } from 'common/services/Services';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
|
||||
const TERMINAL_CLASS_PREFIX = 'xterm-dom-renderer-owner-';
|
||||
@@ -45,7 +45,7 @@ export class DomRenderer extends Disposable implements IRenderer {
|
||||
|
||||
public dimensions: IRenderDimensions;
|
||||
|
||||
public readonly onRequestRedraw = this.register(new EventEmitter<IRequestRedrawEvent>()).event;
|
||||
public readonly onRequestRedraw = this.register(new Emitter<IRequestRedrawEvent>()).event;
|
||||
|
||||
constructor(
|
||||
private readonly _terminal: ITerminal,
|
||||
|
||||
@@ -9,13 +9,13 @@ import { tryDrawCustomChar } from 'browser/renderer/shared/CustomGlyphs';
|
||||
import { computeNextVariantOffset, treatGlyphAsBackgroundColor, isPowerlineGlyph, isRestrictedPowerlineGlyph, throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
|
||||
import { IBoundingBox, ICharAtlasConfig, IRasterizedGlyph, ITextureAtlas } from 'browser/renderer/shared/Types';
|
||||
import { NULL_COLOR, channels, color, rgba } from 'common/Color';
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { FourKeyMap } from 'common/MultiKeyMap';
|
||||
import { IdleTaskQueue } from 'common/TaskQueue';
|
||||
import { IColor } from 'common/Types';
|
||||
import { AttributeData } from 'common/buffer/AttributeData';
|
||||
import { Attributes, DEFAULT_COLOR, DEFAULT_EXT, UnderlineStyle } from 'common/buffer/Constants';
|
||||
import { IUnicodeService } from 'common/services/Services';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
/**
|
||||
* A shared object which is used to draw nothing for a particular cell.
|
||||
@@ -79,9 +79,9 @@ export class TextureAtlas implements ITextureAtlas {
|
||||
public static maxAtlasPages: number | undefined;
|
||||
public static maxTextureSize: number | undefined;
|
||||
|
||||
private readonly _onAddTextureAtlasCanvas = new EventEmitter<HTMLCanvasElement>();
|
||||
private readonly _onAddTextureAtlasCanvas = new Emitter<HTMLCanvasElement>();
|
||||
public readonly onAddTextureAtlasCanvas = this._onAddTextureAtlasCanvas.event;
|
||||
private readonly _onRemoveTextureAtlasCanvas = new EventEmitter<HTMLCanvasElement>();
|
||||
private readonly _onRemoveTextureAtlasCanvas = new Emitter<HTMLCanvasElement>();
|
||||
public readonly onRemoveTextureAtlasCanvas = this._onRemoveTextureAtlasCanvas.event;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
*/
|
||||
|
||||
import { IOptionsService } from 'common/services/Services';
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { ICharSizeService } from 'browser/services/Services';
|
||||
import { Disposable } from 'common/Lifecycle';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export class CharSizeService extends Disposable implements ICharSizeService {
|
||||
public serviceBrand: undefined;
|
||||
@@ -17,7 +17,7 @@ export class CharSizeService extends Disposable implements ICharSizeService {
|
||||
|
||||
public get hasValidSize(): boolean { return this.width > 0 && this.height > 0; }
|
||||
|
||||
private readonly _onCharSizeChange = this.register(new EventEmitter<void>());
|
||||
private readonly _onCharSizeChange = this.register(new Emitter<void>());
|
||||
public readonly onCharSizeChange = this._onCharSizeChange.event;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
|
||||
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
|
||||
import { ICoreBrowserService } from './Services';
|
||||
import { EventEmitter, forwardEvent } from 'common/EventEmitter';
|
||||
import { forwardEvent } from 'common/EventEmitter';
|
||||
import { addDisposableDomListener } from 'browser/Lifecycle';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export class CoreBrowserService extends Disposable implements ICoreBrowserService {
|
||||
public serviceBrand: undefined;
|
||||
@@ -15,9 +16,9 @@ export class CoreBrowserService extends Disposable implements ICoreBrowserServic
|
||||
private _cachedIsFocused: boolean | undefined = undefined;
|
||||
private _screenDprMonitor = this.register(new ScreenDprMonitor(this._window));
|
||||
|
||||
private readonly _onDprChange = this.register(new EventEmitter<number>());
|
||||
private readonly _onDprChange = this.register(new Emitter<number>());
|
||||
public readonly onDprChange = this._onDprChange.event;
|
||||
private readonly _onWindowChange = this.register(new EventEmitter<Window & typeof globalThis>());
|
||||
private readonly _onWindowChange = this.register(new Emitter<Window & typeof globalThis>());
|
||||
public readonly onWindowChange = this._onWindowChange.event;
|
||||
|
||||
constructor(
|
||||
@@ -80,7 +81,7 @@ class ScreenDprMonitor extends Disposable {
|
||||
private _resolutionMediaMatchList: MediaQueryList | undefined;
|
||||
private _windowResizeListener = this.register(new MutableDisposable());
|
||||
|
||||
private readonly _onDprChange = this.register(new EventEmitter<number>());
|
||||
private readonly _onDprChange = this.register(new Emitter<number>());
|
||||
public readonly onDprChange = this._onDprChange.event;
|
||||
|
||||
constructor(private _parentWindow: Window) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import { EventEmitter } from 'common/EventEmitter';
|
||||
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
|
||||
import { DebouncedIdleTask } from 'common/TaskQueue';
|
||||
import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
interface ISelectionState {
|
||||
start: [number, number] | undefined;
|
||||
@@ -38,7 +39,7 @@ export class RenderService extends Disposable implements IRenderService {
|
||||
columnSelectMode: false
|
||||
};
|
||||
|
||||
private readonly _onDimensionsChange = this.register(new EventEmitter<IRenderDimensions>());
|
||||
private readonly _onDimensionsChange = this.register(new Emitter<IRenderDimensions>());
|
||||
public readonly onDimensionsChange = this._onDimensionsChange.event;
|
||||
private readonly _onRenderedViewportChange = this.register(new EventEmitter<{ start: number, end: number }>());
|
||||
public readonly onRenderedViewportChange = this._onRenderedViewportChange.event;
|
||||
|
||||
@@ -9,7 +9,6 @@ import { moveToCellSequence } from 'browser/input/MoveToCell';
|
||||
import { SelectionModel } from 'browser/selection/SelectionModel';
|
||||
import { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';
|
||||
import { ICoreBrowserService, IMouseService, IRenderService, ISelectionService } from 'browser/services/Services';
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { Disposable, toDisposable } from 'common/Lifecycle';
|
||||
import * as Browser from 'common/Platform';
|
||||
import { IBufferLine, IDisposable } from 'common/Types';
|
||||
@@ -17,6 +16,7 @@ import { getRangeLength } from 'common/buffer/BufferRange';
|
||||
import { CellData } from 'common/buffer/CellData';
|
||||
import { IBuffer } from 'common/buffer/Types';
|
||||
import { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
/**
|
||||
* The number of pixels the mouse needs to be above or below the viewport in
|
||||
@@ -111,13 +111,13 @@ export class SelectionService extends Disposable implements ISelectionService {
|
||||
private _oldSelectionStart: [number, number] | undefined = undefined;
|
||||
private _oldSelectionEnd: [number, number] | undefined = undefined;
|
||||
|
||||
private readonly _onLinuxMouseSelection = this.register(new EventEmitter<string>());
|
||||
private readonly _onLinuxMouseSelection = this.register(new Emitter<string>());
|
||||
public readonly onLinuxMouseSelection = this._onLinuxMouseSelection.event;
|
||||
private readonly _onRedrawRequest = this.register(new EventEmitter<ISelectionRedrawRequestEvent>());
|
||||
private readonly _onRedrawRequest = this.register(new Emitter<ISelectionRedrawRequestEvent>());
|
||||
public readonly onRequestRedraw = this._onRedrawRequest.event;
|
||||
private readonly _onSelectionChange = this.register(new EventEmitter<void>());
|
||||
private readonly _onSelectionChange = this.register(new Emitter<void>());
|
||||
public readonly onSelectionChange = this._onSelectionChange.event;
|
||||
private readonly _onRequestScrollLines = this.register(new EventEmitter<ISelectionRequestScrollLinesEvent>());
|
||||
private readonly _onRequestScrollLines = this.register(new Emitter<ISelectionRequestScrollLinesEvent>());
|
||||
public readonly onRequestScrollLines = this._onRequestScrollLines.event;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -7,10 +7,10 @@ import { ColorContrastCache } from 'browser/ColorContrastCache';
|
||||
import { IThemeService } from 'browser/services/Services';
|
||||
import { DEFAULT_ANSI_COLORS, IColorContrastCache, IColorSet, ReadonlyColorSet } from 'browser/Types';
|
||||
import { color, css, NULL_COLOR } from 'common/Color';
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { Disposable } from 'common/Lifecycle';
|
||||
import { IOptionsService, ITheme } from 'common/services/Services';
|
||||
import { AllColorIndex, IColor, SpecialColorIndex } from 'common/Types';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
interface IRestoreColorSet {
|
||||
foreground: IColor;
|
||||
@@ -40,7 +40,7 @@ export class ThemeService extends Disposable implements IThemeService {
|
||||
|
||||
public get colors(): ReadonlyColorSet { return this._colors; }
|
||||
|
||||
private readonly _onChangeColors = this.register(new EventEmitter<ReadonlyColorSet>());
|
||||
private readonly _onChangeColors = this.register(new Emitter<ReadonlyColorSet>());
|
||||
public readonly onChangeColors = this._onChangeColors.event;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -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" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -24,19 +24,20 @@
|
||||
import { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';
|
||||
import { IBuffer } from 'common/buffer/Types';
|
||||
import { CoreTerminal } from 'common/CoreTerminal';
|
||||
import { EventEmitter, forwardEvent } from 'common/EventEmitter';
|
||||
import { forwardEvent } from 'common/EventEmitter';
|
||||
import { IMarker, ITerminalOptions } from 'common/Types';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export class Terminal extends CoreTerminal {
|
||||
private readonly _onBell = this.register(new EventEmitter<void>());
|
||||
private readonly _onBell = this.register(new Emitter<void>());
|
||||
public readonly onBell = this._onBell.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 _onTitleChange = this.register(new EventEmitter<string>());
|
||||
private readonly _onTitleChange = this.register(new Emitter<string>());
|
||||
public readonly onTitleChange = this._onTitleChange.event;
|
||||
private readonly _onA11yCharEmitter = this.register(new EventEmitter<string>());
|
||||
private readonly _onA11yCharEmitter = this.register(new Emitter<string>());
|
||||
public readonly onA11yChar = this._onA11yCharEmitter.event;
|
||||
private readonly _onA11yTabEmitter = this.register(new EventEmitter<number>());
|
||||
private readonly _onA11yTabEmitter = this.register(new Emitter<number>());
|
||||
public readonly onA11yTab = this._onA11yTabEmitter.event;
|
||||
|
||||
constructor(
|
||||
|
||||
Reference in New Issue
Block a user