Fix lint, split up namespace and interface
This commit is contained in:
@@ -7,7 +7,7 @@ import { FontWeight } from '@xterm/xterm';
|
|||||||
import { IColorSet } from 'browser/Types';
|
import { IColorSet } from 'browser/Types';
|
||||||
import { ISelectionRenderModel } from 'browser/renderer/shared/Types';
|
import { ISelectionRenderModel } from 'browser/renderer/shared/Types';
|
||||||
import { CursorInactiveStyle, CursorStyle, type IDisposable } from 'common/Types';
|
import { CursorInactiveStyle, CursorStyle, type IDisposable } from 'common/Types';
|
||||||
import type { Event } from 'common/Event';
|
import type { IEvent } from 'common/Event';
|
||||||
|
|
||||||
export interface IRenderModel {
|
export interface IRenderModel {
|
||||||
cells: Uint32Array;
|
cells: Uint32Array;
|
||||||
@@ -58,8 +58,8 @@ export interface ICharAtlasConfig {
|
|||||||
export interface ITextureAtlas extends IDisposable {
|
export interface ITextureAtlas extends IDisposable {
|
||||||
readonly pages: { canvas: HTMLCanvasElement, version: number }[];
|
readonly pages: { canvas: HTMLCanvasElement, version: number }[];
|
||||||
|
|
||||||
onAddTextureAtlasCanvas: Event<HTMLCanvasElement>;
|
onAddTextureAtlasCanvas: IEvent<HTMLCanvasElement>;
|
||||||
onRemoveTextureAtlasCanvas: Event<HTMLCanvasElement>;
|
onRemoveTextureAtlasCanvas: IEvent<HTMLCanvasElement>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Warm up the texture atlas, adding common glyphs to avoid slowing early frame.
|
* Warm up the texture atlas, adding common glyphs to avoid slowing early frame.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { ICoreService, IDecorationService, ILogService, IOptionsService } from '
|
|||||||
import { IWebGL2RenderingContext } from './Types';
|
import { IWebGL2RenderingContext } from './Types';
|
||||||
import { WebglRenderer } from './WebglRenderer';
|
import { WebglRenderer } from './WebglRenderer';
|
||||||
import { setTraceLogger } from 'common/services/LogService';
|
import { setTraceLogger } from 'common/services/LogService';
|
||||||
import { Emitter, Event } from 'common/Event';
|
import { Emitter, EventUtils } from 'common/Event';
|
||||||
|
|
||||||
export class WebglAddon extends Disposable implements ITerminalAddon , IWebglApi {
|
export class WebglAddon extends Disposable implements ITerminalAddon , IWebglApi {
|
||||||
private _terminal?: Terminal;
|
private _terminal?: Terminal;
|
||||||
@@ -85,10 +85,10 @@ export class WebglAddon extends Disposable implements ITerminalAddon , IWebglApi
|
|||||||
this._customGlyphs,
|
this._customGlyphs,
|
||||||
this._preserveDrawingBuffer
|
this._preserveDrawingBuffer
|
||||||
));
|
));
|
||||||
this._register(Event.forward(this._renderer.onContextLoss, this._onContextLoss));
|
this._register(EventUtils.forward(this._renderer.onContextLoss, this._onContextLoss));
|
||||||
this._register(Event.forward(this._renderer.onChangeTextureAtlas, this._onChangeTextureAtlas));
|
this._register(EventUtils.forward(this._renderer.onChangeTextureAtlas, this._onChangeTextureAtlas));
|
||||||
this._register(Event.forward(this._renderer.onAddTextureAtlasCanvas, this._onAddTextureAtlasCanvas));
|
this._register(EventUtils.forward(this._renderer.onAddTextureAtlasCanvas, this._onAddTextureAtlasCanvas));
|
||||||
this._register(Event.forward(this._renderer.onRemoveTextureAtlasCanvas, this._onRemoveTextureAtlasCanvas));
|
this._register(EventUtils.forward(this._renderer.onRemoveTextureAtlasCanvas, this._onRemoveTextureAtlasCanvas));
|
||||||
renderService.setRenderer(this._renderer);
|
renderService.setRenderer(this._renderer);
|
||||||
|
|
||||||
this._register(toDisposable(() => {
|
this._register(toDisposable(() => {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import { COMBINED_CHAR_BIT_MASK, RENDER_MODEL_BG_OFFSET, RENDER_MODEL_EXT_OFFSET
|
|||||||
import { IWebGL2RenderingContext, type ITextureAtlas } from './Types';
|
import { IWebGL2RenderingContext, type ITextureAtlas } from './Types';
|
||||||
import { LinkRenderLayer } from './renderLayer/LinkRenderLayer';
|
import { LinkRenderLayer } from './renderLayer/LinkRenderLayer';
|
||||||
import { IRenderLayer } from './renderLayer/Types';
|
import { IRenderLayer } from './renderLayer/Types';
|
||||||
import { Emitter, Event } from 'common/Event';
|
import { Emitter, EventUtils } from 'common/Event';
|
||||||
import { addDisposableListener } from 'vs/base/browser/dom';
|
import { addDisposableListener } from 'vs/base/browser/dom';
|
||||||
import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
|
import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
|
||||||
import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
|
import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
|
||||||
@@ -290,8 +290,8 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|||||||
if (this._charAtlas !== atlas) {
|
if (this._charAtlas !== atlas) {
|
||||||
this._onChangeTextureAtlas.fire(atlas.pages[0].canvas);
|
this._onChangeTextureAtlas.fire(atlas.pages[0].canvas);
|
||||||
this._charAtlasDisposable.value = combinedDisposable(
|
this._charAtlasDisposable.value = combinedDisposable(
|
||||||
Event.forward(atlas.onAddTextureAtlasCanvas, this._onAddTextureAtlasCanvas),
|
EventUtils.forward(atlas.onAddTextureAtlasCanvas, this._onAddTextureAtlasCanvas),
|
||||||
Event.forward(atlas.onRemoveTextureAtlasCanvas, this._onRemoveTextureAtlasCanvas)
|
EventUtils.forward(atlas.onRemoveTextureAtlasCanvas, this._onRemoveTextureAtlasCanvas)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this._charAtlas = atlas;
|
this._charAtlas = atlas;
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ import { IDecorationService } from 'common/services/Services';
|
|||||||
import { WindowsOptionsReportType } from '../common/InputHandler';
|
import { WindowsOptionsReportType } from '../common/InputHandler';
|
||||||
import { AccessibilityManager } from './AccessibilityManager';
|
import { AccessibilityManager } from './AccessibilityManager';
|
||||||
import { Linkifier } from './Linkifier';
|
import { Linkifier } from './Linkifier';
|
||||||
import { Emitter, Event } from 'common/Event';
|
import { Emitter, EventUtils, type IEvent } from 'common/Event';
|
||||||
import { addDisposableListener } from 'vs/base/browser/dom';
|
import { addDisposableListener } from 'vs/base/browser/dom';
|
||||||
import { MutableDisposable, toDisposable } from 'common/Lifecycle';
|
import { MutableDisposable, toDisposable } from 'common/Lifecycle';
|
||||||
|
|
||||||
@@ -135,15 +135,15 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
|
|||||||
public readonly onBell = this._onBell.event;
|
public readonly onBell = this._onBell.event;
|
||||||
|
|
||||||
private _onFocus = this._register(new Emitter<void>());
|
private _onFocus = this._register(new Emitter<void>());
|
||||||
public get onFocus(): Event<void> { return this._onFocus.event; }
|
public get onFocus(): IEvent<void> { return this._onFocus.event; }
|
||||||
private _onBlur = this._register(new Emitter<void>());
|
private _onBlur = this._register(new Emitter<void>());
|
||||||
public get onBlur(): Event<void> { return this._onBlur.event; }
|
public get onBlur(): IEvent<void> { return this._onBlur.event; }
|
||||||
private _onA11yCharEmitter = this._register(new Emitter<string>());
|
private _onA11yCharEmitter = this._register(new Emitter<string>());
|
||||||
public get onA11yChar(): Event<string> { return this._onA11yCharEmitter.event; }
|
public get onA11yChar(): IEvent<string> { return this._onA11yCharEmitter.event; }
|
||||||
private _onA11yTabEmitter = this._register(new Emitter<number>());
|
private _onA11yTabEmitter = this._register(new Emitter<number>());
|
||||||
public get onA11yTab(): Event<number> { return this._onA11yTabEmitter.event; }
|
public get onA11yTab(): IEvent<number> { return this._onA11yTabEmitter.event; }
|
||||||
private _onWillOpen = this._register(new Emitter<HTMLElement>());
|
private _onWillOpen = this._register(new Emitter<HTMLElement>());
|
||||||
public get onWillOpen(): Event<HTMLElement> { return this._onWillOpen.event; }
|
public get onWillOpen(): IEvent<HTMLElement> { return this._onWillOpen.event; }
|
||||||
private readonly _onDimensionsChange = this._register(new Emitter<IRenderDimensionsApi>());
|
private readonly _onDimensionsChange = this._register(new Emitter<IRenderDimensionsApi>());
|
||||||
public readonly onDimensionsChange = this._onDimensionsChange.event;
|
public readonly onDimensionsChange = this._onDimensionsChange.event;
|
||||||
|
|
||||||
@@ -187,10 +187,10 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
|
|||||||
this._register(this._inputHandler.onRequestReset(() => this.reset()));
|
this._register(this._inputHandler.onRequestReset(() => this.reset()));
|
||||||
this._register(this._inputHandler.onRequestWindowsOptionsReport(type => this._reportWindowsOptions(type)));
|
this._register(this._inputHandler.onRequestWindowsOptionsReport(type => this._reportWindowsOptions(type)));
|
||||||
this._register(this._inputHandler.onColor((event) => this._handleColorEvent(event)));
|
this._register(this._inputHandler.onColor((event) => this._handleColorEvent(event)));
|
||||||
this._register(Event.forward(this._inputHandler.onCursorMove, this._onCursorMove));
|
this._register(EventUtils.forward(this._inputHandler.onCursorMove, this._onCursorMove));
|
||||||
this._register(Event.forward(this._inputHandler.onTitleChange, this._onTitleChange));
|
this._register(EventUtils.forward(this._inputHandler.onTitleChange, this._onTitleChange));
|
||||||
this._register(Event.forward(this._inputHandler.onA11yChar, this._onA11yCharEmitter));
|
this._register(EventUtils.forward(this._inputHandler.onA11yChar, this._onA11yCharEmitter));
|
||||||
this._register(Event.forward(this._inputHandler.onA11yTab, this._onA11yTabEmitter));
|
this._register(EventUtils.forward(this._inputHandler.onA11yTab, this._onA11yTabEmitter));
|
||||||
|
|
||||||
// Setup listeners
|
// Setup listeners
|
||||||
this._register(this._bufferService.onResize(e => this._afterResize(e.cols, e.rows)));
|
this._register(this._bufferService.onResize(e => this._afterResize(e.cols, e.rows)));
|
||||||
@@ -566,7 +566,7 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
|
|||||||
this.textarea!.focus();
|
this.textarea!.focus();
|
||||||
this.textarea!.select();
|
this.textarea!.select();
|
||||||
}));
|
}));
|
||||||
this._register(Event.any(
|
this._register(EventUtils.any(
|
||||||
this._onScroll.event,
|
this._onScroll.event,
|
||||||
this._inputHandler.onScroll
|
this._inputHandler.onScroll
|
||||||
)(() => {
|
)(() => {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { AttributeData } from 'common/buffer/AttributeData';
|
|||||||
import { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';
|
import { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';
|
||||||
import { css } from 'common/Color';
|
import { css } from 'common/Color';
|
||||||
import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
|
import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
|
||||||
import { Emitter, type Event } from 'common/Event';
|
import { Emitter, type IEvent } from 'common/Event';
|
||||||
|
|
||||||
export class TestTerminal extends CoreBrowserTerminal {
|
export class TestTerminal extends CoreBrowserTerminal {
|
||||||
public get curAttrData(): IAttributeData { return (this as any)._inputHandler._curAttrData; }
|
public get curAttrData(): IAttributeData { return (this as any)._inputHandler._curAttrData; }
|
||||||
@@ -30,24 +30,24 @@ export class TestTerminal extends CoreBrowserTerminal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class MockTerminal implements ITerminal {
|
export class MockTerminal implements ITerminal {
|
||||||
public onBlur!: Event<void>;
|
public onBlur!: IEvent<void>;
|
||||||
public onFocus!: Event<void>;
|
public onFocus!: IEvent<void>;
|
||||||
public onA11yChar!: Event<string>;
|
public onA11yChar!: IEvent<string>;
|
||||||
public onWriteParsed!: Event<void>;
|
public onWriteParsed!: IEvent<void>;
|
||||||
public onA11yTab!: Event<number>;
|
public onA11yTab!: IEvent<number>;
|
||||||
public onCursorMove!: Event<void>;
|
public onCursorMove!: IEvent<void>;
|
||||||
public onLineFeed!: Event<void>;
|
public onLineFeed!: IEvent<void>;
|
||||||
public onSelectionChange!: Event<void>;
|
public onSelectionChange!: IEvent<void>;
|
||||||
public onData!: Event<string>;
|
public onData!: IEvent<string>;
|
||||||
public onBinary!: Event<string>;
|
public onBinary!: IEvent<string>;
|
||||||
public onTitleChange!: Event<string>;
|
public onTitleChange!: IEvent<string>;
|
||||||
public onBell!: Event<void>;
|
public onBell!: IEvent<void>;
|
||||||
public onScroll!: Event<number>;
|
public onScroll!: IEvent<number>;
|
||||||
public onWillOpen!: Event<HTMLElement>;
|
public onWillOpen!: IEvent<HTMLElement>;
|
||||||
public onKey!: Event<{ key: string, domEvent: KeyboardEvent }>;
|
public onKey!: IEvent<{ key: string, domEvent: KeyboardEvent }>;
|
||||||
public onRender!: Event<{ start: number, end: number }>;
|
public onRender!: IEvent<{ start: number, end: number }>;
|
||||||
public onResize!: Event<{ cols: number, rows: number }>;
|
public onResize!: IEvent<{ cols: number, rows: number }>;
|
||||||
public onDimensionsChange!: Event<IRenderDimensionsApi>;
|
public onDimensionsChange!: IEvent<IRenderDimensionsApi>;
|
||||||
public dimensions: IRenderDimensionsApi | undefined;
|
public dimensions: IRenderDimensionsApi | undefined;
|
||||||
public markers!: IMarker[];
|
public markers!: IMarker[];
|
||||||
public linkifier: ILinkifier2 | undefined;
|
public linkifier: ILinkifier2 | undefined;
|
||||||
@@ -273,9 +273,9 @@ export class MockBuffer implements IBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class MockRenderer implements IRenderer {
|
export class MockRenderer implements IRenderer {
|
||||||
public onRequestRedraw!: Event<IRequestRedrawEvent>;
|
public onRequestRedraw!: IEvent<IRequestRedrawEvent>;
|
||||||
public onCanvasResize!: Event<{ width: number, height: number }>;
|
public onCanvasResize!: IEvent<{ width: number, height: number }>;
|
||||||
public onRender!: Event<{ start: number, end: number }>;
|
public onRender!: IEvent<{ start: number, end: number }>;
|
||||||
public dispose(): void {
|
public dispose(): void {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
@@ -378,7 +378,7 @@ export class MockCoreBrowserService implements ICoreBrowserService {
|
|||||||
export class MockCharSizeService implements ICharSizeService {
|
export class MockCharSizeService implements ICharSizeService {
|
||||||
public serviceBrand: undefined;
|
public serviceBrand: undefined;
|
||||||
public get hasValidSize(): boolean { return this.width > 0 && this.height > 0; }
|
public get hasValidSize(): boolean { return this.width > 0 && this.height > 0; }
|
||||||
public onCharSizeChange: Event<void> = new Emitter<void>().event;
|
public onCharSizeChange: IEvent<void> = new Emitter<void>().event;
|
||||||
constructor(public width: number, public height: number) {}
|
constructor(public width: number, public height: number) {}
|
||||||
public measure(): void {}
|
public measure(): void {}
|
||||||
}
|
}
|
||||||
@@ -396,10 +396,10 @@ export class MockMouseService implements IMouseService {
|
|||||||
|
|
||||||
export class MockRenderService implements IRenderService {
|
export class MockRenderService implements IRenderService {
|
||||||
public serviceBrand: undefined;
|
public serviceBrand: undefined;
|
||||||
public onDimensionsChange: Event<IRenderDimensions> = new Emitter<IRenderDimensions>().event;
|
public onDimensionsChange: IEvent<IRenderDimensions> = new Emitter<IRenderDimensions>().event;
|
||||||
public onRenderedViewportChange: Event<{ start: number, end: number }> = new Emitter<{ start: number, end: number }>().event;
|
public onRenderedViewportChange: IEvent<{ start: number, end: number }> = new Emitter<{ start: number, end: number }>().event;
|
||||||
public onRender: Event<{ start: number, end: number }> = new Emitter<{ start: number, end: number }>().event;
|
public onRender: IEvent<{ start: number, end: number }> = new Emitter<{ start: number, end: number }>().event;
|
||||||
public onRefreshRequest: Event<{ start: number, end: number}> = new Emitter<{ start: number, end: number }>().event;
|
public onRefreshRequest: IEvent<{ start: number, end: number}> = new Emitter<{ start: number, end: number }>().event;
|
||||||
public dimensions: IRenderDimensions = createRenderDimensions();
|
public dimensions: IRenderDimensions = createRenderDimensions();
|
||||||
public refreshRows(start: number, end: number): void {
|
public refreshRows(start: number, end: number): void {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
|
|||||||
+10
-10
@@ -7,7 +7,7 @@ import { CharData, IColor, ICoreTerminal, ITerminalOptions } from 'common/Types'
|
|||||||
import { IBuffer } from 'common/buffer/Types';
|
import { IBuffer } from 'common/buffer/Types';
|
||||||
import { IDisposable, IRenderDimensions as IRenderDimensionsApi, Terminal as ITerminalApi } from '@xterm/xterm';
|
import { IDisposable, IRenderDimensions as IRenderDimensionsApi, Terminal as ITerminalApi } from '@xterm/xterm';
|
||||||
import { channels, css } from 'common/Color';
|
import { channels, css } from 'common/Color';
|
||||||
import type { Event } from 'common/Event';
|
import type { IEvent } from 'common/Event';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A portion of the public API that are implemented identially internally and simply passed through.
|
* A portion of the public API that are implemented identially internally and simply passed through.
|
||||||
@@ -23,12 +23,12 @@ export interface ITerminal extends InternalPassthroughApis, ICoreTerminal {
|
|||||||
|
|
||||||
readonly dimensions: IRenderDimensionsApi | undefined;
|
readonly dimensions: IRenderDimensionsApi | undefined;
|
||||||
|
|
||||||
onBlur: Event<void>;
|
onBlur: IEvent<void>;
|
||||||
onFocus: Event<void>;
|
onFocus: IEvent<void>;
|
||||||
onDimensionsChange: Event<IRenderDimensionsApi>;
|
onDimensionsChange: IEvent<IRenderDimensionsApi>;
|
||||||
onA11yChar: Event<string>;
|
onA11yChar: IEvent<string>;
|
||||||
onA11yTab: Event<number>;
|
onA11yTab: IEvent<number>;
|
||||||
onWillOpen: Event<HTMLElement>;
|
onWillOpen: IEvent<HTMLElement>;
|
||||||
|
|
||||||
cancel(ev: MouseEvent | WheelEvent | KeyboardEvent | InputEvent, force?: boolean): boolean | void;
|
cancel(ev: MouseEvent | WheelEvent | KeyboardEvent | InputEvent, force?: boolean): boolean | void;
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ export interface IPartialColorSet {
|
|||||||
|
|
||||||
export interface IViewport extends IDisposable {
|
export interface IViewport extends IDisposable {
|
||||||
scrollBarWidth: number;
|
scrollBarWidth: number;
|
||||||
readonly onRequestScrollLines: Event<{ amount: number, suppressScrollEvent: boolean }>;
|
readonly onRequestScrollLines: IEvent<{ amount: number, suppressScrollEvent: boolean }>;
|
||||||
syncScrollArea(immediate?: boolean, force?: boolean): void;
|
syncScrollArea(immediate?: boolean, force?: boolean): void;
|
||||||
getLinesScrolled(ev: WheelEvent): number;
|
getLinesScrolled(ev: WheelEvent): number;
|
||||||
getBufferElements(startLine: number, endLine?: number): { bufferElements: HTMLElement[], cursorElement?: HTMLElement };
|
getBufferElements(startLine: number, endLine?: number): { bufferElements: HTMLElement[], cursorElement?: HTMLElement };
|
||||||
@@ -131,8 +131,8 @@ export interface ILinkWithState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ILinkifier2 extends IDisposable {
|
export interface ILinkifier2 extends IDisposable {
|
||||||
onShowLinkUnderline: Event<ILinkifierEvent>;
|
onShowLinkUnderline: IEvent<ILinkifierEvent>;
|
||||||
onHideLinkUnderline: Event<ILinkifierEvent>;
|
onHideLinkUnderline: IEvent<ILinkifierEvent>;
|
||||||
readonly currentLink: ILinkWithState | undefined;
|
readonly currentLink: ILinkWithState | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { CoreMouseEventType } from 'common/Types';
|
|||||||
import { addDisposableListener, scheduleAtNextAnimationFrame } from 'vs/base/browser/dom';
|
import { addDisposableListener, scheduleAtNextAnimationFrame } from 'vs/base/browser/dom';
|
||||||
import { SmoothScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
|
import { SmoothScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
|
||||||
import type { ScrollableElementChangeOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';
|
import type { ScrollableElementChangeOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';
|
||||||
import { Emitter, Event } from 'common/Event';
|
import { Emitter, EventUtils } from 'common/Event';
|
||||||
import { Scrollable, ScrollbarVisibility, type ScrollEvent } from 'vs/base/common/scrollable';
|
import { Scrollable, ScrollbarVisibility, type ScrollEvent } from 'vs/base/common/scrollable';
|
||||||
import { Gesture, EventType as GestureEventType, type GestureEvent } from 'vs/base/browser/touch';
|
import { Gesture, EventType as GestureEventType, type GestureEvent } from 'vs/base/browser/touch';
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ export class Viewport extends Disposable {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
this._scrollableElement.setScrollDimensions({ height: 0, scrollHeight: 0 });
|
this._scrollableElement.setScrollDimensions({ height: 0, scrollHeight: 0 });
|
||||||
this._register(Event.runAndSubscribe(themeService.onChangeColors, () => {
|
this._register(EventUtils.runAndSubscribe(themeService.onChangeColors, () => {
|
||||||
element.style.backgroundColor = themeService.colors.background.css;
|
element.style.backgroundColor = themeService.colors.background.css;
|
||||||
this._scrollableElement.getDomNode().style.backgroundColor = themeService.colors.background.css;
|
this._scrollableElement.getDomNode().style.backgroundColor = themeService.colors.background.css;
|
||||||
}));
|
}));
|
||||||
@@ -81,7 +81,7 @@ export class Viewport extends Disposable {
|
|||||||
this._styleElement = coreBrowserService.mainDocument.createElement('style');
|
this._styleElement = coreBrowserService.mainDocument.createElement('style');
|
||||||
screenElement.appendChild(this._styleElement);
|
screenElement.appendChild(this._styleElement);
|
||||||
this._register(toDisposable(() => this._styleElement.remove()));
|
this._register(toDisposable(() => this._styleElement.remove()));
|
||||||
this._register(Event.runAndSubscribe(themeService.onChangeColors, () => {
|
this._register(EventUtils.runAndSubscribe(themeService.onChangeColors, () => {
|
||||||
this._styleElement.textContent = [
|
this._styleElement.textContent = [
|
||||||
`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,
|
`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,
|
||||||
` background: ${themeService.colors.scrollbarSliderBackground.css};`,
|
` background: ${themeService.colors.scrollbarSliderBackground.css};`,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { BufferNamespaceApi } from 'common/public/BufferNamespaceApi';
|
|||||||
import { ParserApi } from 'common/public/ParserApi';
|
import { ParserApi } from 'common/public/ParserApi';
|
||||||
import { UnicodeApi } from 'common/public/UnicodeApi';
|
import { UnicodeApi } from 'common/public/UnicodeApi';
|
||||||
import { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, IRenderDimensions, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from '@xterm/xterm';
|
import { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, IRenderDimensions, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from '@xterm/xterm';
|
||||||
import type { Event } from 'common/Event';
|
import type { IEvent } from 'common/Event';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The set of options that only have an effect when set in the Terminal constructor.
|
* The set of options that only have an effect when set in the Terminal constructor.
|
||||||
@@ -68,19 +68,19 @@ export class Terminal extends Disposable implements ITerminalApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public get onBell(): Event<void> { return this._core.onBell; }
|
public get onBell(): IEvent<void> { return this._core.onBell; }
|
||||||
public get onBinary(): Event<string> { return this._core.onBinary; }
|
public get onBinary(): IEvent<string> { return this._core.onBinary; }
|
||||||
public get onCursorMove(): Event<void> { return this._core.onCursorMove; }
|
public get onCursorMove(): IEvent<void> { return this._core.onCursorMove; }
|
||||||
public get onData(): Event<string> { return this._core.onData; }
|
public get onData(): IEvent<string> { return this._core.onData; }
|
||||||
public get onKey(): Event<{ key: string, domEvent: KeyboardEvent }> { return this._core.onKey; }
|
public get onKey(): IEvent<{ key: string, domEvent: KeyboardEvent }> { return this._core.onKey; }
|
||||||
public get onLineFeed(): Event<void> { return this._core.onLineFeed; }
|
public get onLineFeed(): IEvent<void> { return this._core.onLineFeed; }
|
||||||
public get onRender(): Event<{ start: number, end: number }> { return this._core.onRender; }
|
public get onRender(): IEvent<{ start: number, end: number }> { return this._core.onRender; }
|
||||||
public get onResize(): Event<{ cols: number, rows: number }> { return this._core.onResize; }
|
public get onResize(): IEvent<{ cols: number, rows: number }> { return this._core.onResize; }
|
||||||
public get onScroll(): Event<number> { return this._core.onScroll; }
|
public get onScroll(): IEvent<number> { return this._core.onScroll; }
|
||||||
public get onSelectionChange(): Event<void> { return this._core.onSelectionChange; }
|
public get onSelectionChange(): IEvent<void> { return this._core.onSelectionChange; }
|
||||||
public get onTitleChange(): Event<string> { return this._core.onTitleChange; }
|
public get onTitleChange(): IEvent<string> { return this._core.onTitleChange; }
|
||||||
public get onWriteParsed(): Event<void> { return this._core.onWriteParsed; }
|
public get onWriteParsed(): IEvent<void> { return this._core.onWriteParsed; }
|
||||||
public get onDimensionsChange(): Event<IRenderDimensions> { return this._core.onDimensionsChange; }
|
public get onDimensionsChange(): IEvent<IRenderDimensions> { return this._core.onDimensionsChange; }
|
||||||
|
|
||||||
public get element(): HTMLElement | undefined { return this._core.element; }
|
public get element(): HTMLElement | undefined { return this._core.element; }
|
||||||
public get parser(): IParser {
|
public get parser(): IParser {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import { Terminal } from '@xterm/xterm';
|
import { Terminal } from '@xterm/xterm';
|
||||||
import { ITerminal } from 'browser/Types';
|
import { ITerminal } from 'browser/Types';
|
||||||
import { IDisposable } from 'common/Types';
|
import { IDisposable } from 'common/Types';
|
||||||
import type { Event } from 'common/Event';
|
import type { IEvent } from 'common/Event';
|
||||||
|
|
||||||
export interface IDimensions {
|
export interface IDimensions {
|
||||||
width: number;
|
width: number;
|
||||||
@@ -57,7 +57,7 @@ export interface IRenderer extends IDisposable {
|
|||||||
* Fires when the renderer is requesting to be redrawn on the next animation
|
* Fires when the renderer is requesting to be redrawn on the next animation
|
||||||
* frame but is _not_ a result of content changing (eg. selection changes).
|
* frame but is _not_ a result of content changing (eg. selection changes).
|
||||||
*/
|
*/
|
||||||
readonly onRequestRedraw: Event<IRequestRedrawEvent>;
|
readonly onRequestRedraw: IEvent<IRequestRedrawEvent>;
|
||||||
|
|
||||||
dispose(): void;
|
dispose(): void;
|
||||||
handleDevicePixelRatioChange(): void;
|
handleDevicePixelRatioChange(): void;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { ICoreBrowserService } from './Services';
|
import { ICoreBrowserService } from './Services';
|
||||||
import { Emitter, Event } from 'common/Event';
|
import { Emitter, EventUtils } from 'common/Event';
|
||||||
import { addDisposableListener } from 'vs/base/browser/dom';
|
import { addDisposableListener } from 'vs/base/browser/dom';
|
||||||
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
|
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ export class CoreBrowserService extends Disposable implements ICoreBrowserServic
|
|||||||
|
|
||||||
// Monitor device pixel ratio
|
// Monitor device pixel ratio
|
||||||
this._register(this.onWindowChange(w => this._screenDprMonitor.setWindow(w)));
|
this._register(this.onWindowChange(w => this._screenDprMonitor.setWindow(w)));
|
||||||
this._register(Event.forward(this._screenDprMonitor.onDprChange, this._onDprChange));
|
this._register(EventUtils.forward(this._screenDprMonitor.onDprChange, this._onDprChange));
|
||||||
|
|
||||||
this._register(addDisposableListener(this._textarea, 'focus', () => this._isFocused = true));
|
this._register(addDisposableListener(this._textarea, 'focus', () => this._isFocused = true));
|
||||||
this._register(addDisposableListener(this._textarea, 'blur', () => this._isFocused = false));
|
this._register(addDisposableListener(this._textarea, 'blur', () => this._isFocused = false));
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { IColorSet, ILink, ReadonlyColorSet } from 'browser/Types';
|
|||||||
import { ISelectionRedrawRequestEvent as ISelectionRequestRedrawEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';
|
import { ISelectionRedrawRequestEvent as ISelectionRequestRedrawEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';
|
||||||
import { createDecorator } from 'common/services/ServiceRegistry';
|
import { createDecorator } from 'common/services/ServiceRegistry';
|
||||||
import { AllColorIndex, IDisposable, IKeyboardResult } from 'common/Types';
|
import { AllColorIndex, IDisposable, IKeyboardResult } from 'common/Types';
|
||||||
import type { Event } from 'common/Event';
|
import type { IEvent } from 'common/Event';
|
||||||
|
|
||||||
export const ICharSizeService = createDecorator<ICharSizeService>('CharSizeService');
|
export const ICharSizeService = createDecorator<ICharSizeService>('CharSizeService');
|
||||||
export interface ICharSizeService {
|
export interface ICharSizeService {
|
||||||
@@ -18,7 +18,7 @@ export interface ICharSizeService {
|
|||||||
readonly height: number;
|
readonly height: number;
|
||||||
readonly hasValidSize: boolean;
|
readonly hasValidSize: boolean;
|
||||||
|
|
||||||
readonly onCharSizeChange: Event<void>;
|
readonly onCharSizeChange: IEvent<void>;
|
||||||
|
|
||||||
measure(): void;
|
measure(): void;
|
||||||
}
|
}
|
||||||
@@ -29,8 +29,8 @@ export interface ICoreBrowserService {
|
|||||||
|
|
||||||
readonly isFocused: boolean;
|
readonly isFocused: boolean;
|
||||||
|
|
||||||
readonly onDprChange: Event<number>;
|
readonly onDprChange: IEvent<number>;
|
||||||
readonly onWindowChange: Event<Window & typeof globalThis>;
|
readonly onWindowChange: IEvent<Window & typeof globalThis>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets or sets the parent window that the terminal is rendered into. DOM and rendering APIs (e.g.
|
* Gets or sets the parent window that the terminal is rendered into. DOM and rendering APIs (e.g.
|
||||||
@@ -61,17 +61,17 @@ export const IRenderService = createDecorator<IRenderService>('RenderService');
|
|||||||
export interface IRenderService extends IDisposable {
|
export interface IRenderService extends IDisposable {
|
||||||
serviceBrand: undefined;
|
serviceBrand: undefined;
|
||||||
|
|
||||||
onDimensionsChange: Event<IRenderDimensions>;
|
onDimensionsChange: IEvent<IRenderDimensions>;
|
||||||
/**
|
/**
|
||||||
* Fires when buffer changes are rendered. This does not fire when only cursor
|
* Fires when buffer changes are rendered. This does not fire when only cursor
|
||||||
* or selections are rendered.
|
* or selections are rendered.
|
||||||
*/
|
*/
|
||||||
onRenderedViewportChange: Event<{ start: number, end: number }>;
|
onRenderedViewportChange: IEvent<{ start: number, end: number }>;
|
||||||
/**
|
/**
|
||||||
* Fires on render
|
* Fires on render
|
||||||
*/
|
*/
|
||||||
onRender: Event<{ start: number, end: number }>;
|
onRender: IEvent<{ start: number, end: number }>;
|
||||||
onRefreshRequest: Event<{ start: number, end: number }>;
|
onRefreshRequest: IEvent<{ start: number, end: number }>;
|
||||||
|
|
||||||
dimensions: IRenderDimensions;
|
dimensions: IRenderDimensions;
|
||||||
|
|
||||||
@@ -101,10 +101,10 @@ export interface ISelectionService {
|
|||||||
readonly selectionStart: [number, number] | undefined;
|
readonly selectionStart: [number, number] | undefined;
|
||||||
readonly selectionEnd: [number, number] | undefined;
|
readonly selectionEnd: [number, number] | undefined;
|
||||||
|
|
||||||
readonly onLinuxMouseSelection: Event<string>;
|
readonly onLinuxMouseSelection: IEvent<string>;
|
||||||
readonly onRequestRedraw: Event<ISelectionRequestRedrawEvent>;
|
readonly onRequestRedraw: IEvent<ISelectionRequestRedrawEvent>;
|
||||||
readonly onRequestScrollLines: Event<ISelectionRequestScrollLinesEvent>;
|
readonly onRequestScrollLines: IEvent<ISelectionRequestScrollLinesEvent>;
|
||||||
readonly onSelectionChange: Event<void>;
|
readonly onSelectionChange: IEvent<void>;
|
||||||
|
|
||||||
disable(): void;
|
disable(): void;
|
||||||
enable(): void;
|
enable(): void;
|
||||||
@@ -136,7 +136,7 @@ export interface IThemeService {
|
|||||||
|
|
||||||
readonly colors: ReadonlyColorSet;
|
readonly colors: ReadonlyColorSet;
|
||||||
|
|
||||||
readonly onChangeColors: Event<ReadonlyColorSet>;
|
readonly onChangeColors: IEvent<ReadonlyColorSet>;
|
||||||
|
|
||||||
restoreColor(slot?: AllColorIndex): void;
|
restoreColor(slot?: AllColorIndex): void;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import { IBufferSet } from 'common/buffer/Types';
|
|||||||
import { InputHandler } from 'common/InputHandler';
|
import { InputHandler } from 'common/InputHandler';
|
||||||
import { WriteBuffer } from 'common/input/WriteBuffer';
|
import { WriteBuffer } from 'common/input/WriteBuffer';
|
||||||
import { OscLinkService } from 'common/services/OscLinkService';
|
import { OscLinkService } from 'common/services/OscLinkService';
|
||||||
import { Emitter, Event } from 'common/Event';
|
import { Emitter, EventUtils, type IEvent } from 'common/Event';
|
||||||
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
|
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
|
||||||
|
|
||||||
// Only trigger this warning a single time per session
|
// Only trigger this warning a single time per session
|
||||||
@@ -78,7 +78,7 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
|||||||
*/
|
*/
|
||||||
protected _onScrollApi?: Emitter<number>;
|
protected _onScrollApi?: Emitter<number>;
|
||||||
protected _onScroll = this._register(new Emitter<IScrollEvent>());
|
protected _onScroll = this._register(new Emitter<IScrollEvent>());
|
||||||
public get onScroll(): Event<number> {
|
public get onScroll(): IEvent<number> {
|
||||||
if (!this._onScrollApi) {
|
if (!this._onScrollApi) {
|
||||||
this._onScrollApi = this._register(new Emitter<number>());
|
this._onScrollApi = this._register(new Emitter<number>());
|
||||||
this._onScroll.event(ev => {
|
this._onScroll.event(ev => {
|
||||||
@@ -125,12 +125,12 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
|||||||
|
|
||||||
// Register input handler and handle/forward events
|
// Register input handler and handle/forward events
|
||||||
this._inputHandler = this._register(new InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService));
|
this._inputHandler = this._register(new InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService));
|
||||||
this._register(Event.forward(this._inputHandler.onLineFeed, this._onLineFeed));
|
this._register(EventUtils.forward(this._inputHandler.onLineFeed, this._onLineFeed));
|
||||||
|
|
||||||
// Setup listeners
|
// Setup listeners
|
||||||
this._register(Event.forward(this._bufferService.onResize, this._onResize));
|
this._register(EventUtils.forward(this._bufferService.onResize, this._onResize));
|
||||||
this._register(Event.forward(this.coreService.onData, this._onData));
|
this._register(EventUtils.forward(this.coreService.onData, this._onData));
|
||||||
this._register(Event.forward(this.coreService.onBinary, this._onBinary));
|
this._register(EventUtils.forward(this.coreService.onBinary, this._onBinary));
|
||||||
this._register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom(true)));
|
this._register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom(true)));
|
||||||
this._register(this.coreService.onUserInput(() => this._writeBuffer.handleUserInput()));
|
this._register(this.coreService.onUserInput(() => this._writeBuffer.handleUserInput()));
|
||||||
this._register(this.optionsService.onMultipleOptionChange(['windowsPty'], () => this._handleWindowsPtyOptionChange()));
|
this._register(this.optionsService.onMultipleOptionChange(['windowsPty'], () => this._handleWindowsPtyOptionChange()));
|
||||||
@@ -140,7 +140,7 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
|||||||
}));
|
}));
|
||||||
// Setup WriteBuffer
|
// Setup WriteBuffer
|
||||||
this._writeBuffer = this._register(new WriteBuffer((data, promiseResult) => this._inputHandler.parse(data, promiseResult)));
|
this._writeBuffer = this._register(new WriteBuffer((data, promiseResult) => this._inputHandler.parse(data, promiseResult)));
|
||||||
this._register(Event.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));
|
this._register(EventUtils.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));
|
||||||
}
|
}
|
||||||
|
|
||||||
public write(data: string | Uint8Array, callback?: () => void): void {
|
public write(data: string | Uint8Array, callback?: () => void): void {
|
||||||
|
|||||||
+1
-1
@@ -68,7 +68,7 @@ export class Emitter<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace Event {
|
export namespace EventUtils {
|
||||||
export function forward<T>(from: IEvent<T>, to: Emitter<T>): IDisposable {
|
export function forward<T>(from: IEvent<T>, to: Emitter<T>): IDisposable {
|
||||||
return from(e => to.fire(e));
|
return from(e => to.fire(e));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ import { BufferSet } from 'common/buffer/BufferSet';
|
|||||||
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEventType, ICharset, IModes, IAttributeData, IOscLinkData, IDisposable } from 'common/Types';
|
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEventType, ICharset, IModes, IAttributeData, IOscLinkData, IDisposable } from 'common/Types';
|
||||||
import { UnicodeV6 } from 'common/input/UnicodeV6';
|
import { UnicodeV6 } from 'common/input/UnicodeV6';
|
||||||
import { IDecorationOptions, IDecoration } from '@xterm/xterm';
|
import { IDecorationOptions, IDecoration } from '@xterm/xterm';
|
||||||
import { Emitter, type Event } from 'common/Event';
|
import { Emitter, type IEvent } from 'common/Event';
|
||||||
|
|
||||||
export class MockBufferService implements IBufferService {
|
export class MockBufferService implements IBufferService {
|
||||||
public serviceBrand: any;
|
public serviceBrand: any;
|
||||||
public get buffer(): IBuffer { return this.buffers.active; }
|
public get buffer(): IBuffer { return this.buffers.active; }
|
||||||
public buffers: IBufferSet = {} as any;
|
public buffers: IBufferSet = {} as any;
|
||||||
public onResize: Event<IBufferResizeEvent> = new Emitter<IBufferResizeEvent>().event;
|
public onResize: IEvent<IBufferResizeEvent> = new Emitter<IBufferResizeEvent>().event;
|
||||||
public onScroll: Event<number> = new Emitter<number>().event;
|
public onScroll: IEvent<number> = new Emitter<number>().event;
|
||||||
private readonly _onScroll = new Emitter<number>();
|
private readonly _onScroll = new Emitter<number>();
|
||||||
public isUserScrolling: boolean = false;
|
public isUserScrolling: boolean = false;
|
||||||
constructor(
|
constructor(
|
||||||
@@ -67,7 +67,7 @@ export class MockCoreMouseService implements ICoreMouseService {
|
|||||||
public addProtocol(name: string): void { }
|
public addProtocol(name: string): void { }
|
||||||
public reset(): void { }
|
public reset(): void { }
|
||||||
public triggerMouseEvent(event: ICoreMouseEvent): boolean { return false; }
|
public triggerMouseEvent(event: ICoreMouseEvent): boolean { return false; }
|
||||||
public onProtocolChange: Event<CoreMouseEventType> = new Emitter<CoreMouseEventType>().event;
|
public onProtocolChange: IEvent<CoreMouseEventType> = new Emitter<CoreMouseEventType>().event;
|
||||||
public explainEvents(events: CoreMouseEventType): { [event: string]: boolean } {
|
public explainEvents(events: CoreMouseEventType): { [event: string]: boolean } {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
@@ -122,10 +122,10 @@ export class MockCoreService implements ICoreService {
|
|||||||
mainStack: [] as number[],
|
mainStack: [] as number[],
|
||||||
altStack: [] as number[]
|
altStack: [] as number[]
|
||||||
};
|
};
|
||||||
public onData: Event<string> = new Emitter<string>().event;
|
public onData: IEvent<string> = new Emitter<string>().event;
|
||||||
public onUserInput: Event<void> = new Emitter<void>().event;
|
public onUserInput: IEvent<void> = new Emitter<void>().event;
|
||||||
public onBinary: Event<string> = new Emitter<string>().event;
|
public onBinary: IEvent<string> = new Emitter<string>().event;
|
||||||
public onRequestScrollToBottom: Event<void> = new Emitter<void>().event;
|
public onRequestScrollToBottom: IEvent<void> = new Emitter<void>().event;
|
||||||
public reset(): void { }
|
public reset(): void { }
|
||||||
public triggerDataEvent(data: string, wasUserInput?: boolean): void { }
|
public triggerDataEvent(data: string, wasUserInput?: boolean): void { }
|
||||||
public triggerBinaryEvent(data: string): void { }
|
public triggerBinaryEvent(data: string): void { }
|
||||||
@@ -145,7 +145,7 @@ export class MockOptionsService implements IOptionsService {
|
|||||||
public serviceBrand: any;
|
public serviceBrand: any;
|
||||||
public readonly rawOptions: Required<ITerminalOptions> = clone(DEFAULT_OPTIONS);
|
public readonly rawOptions: Required<ITerminalOptions> = clone(DEFAULT_OPTIONS);
|
||||||
public options: Required<ITerminalOptions> = this.rawOptions;
|
public options: Required<ITerminalOptions> = this.rawOptions;
|
||||||
public onOptionChange: Event<keyof ITerminalOptions> = new Emitter<keyof ITerminalOptions>().event;
|
public onOptionChange: IEvent<keyof ITerminalOptions> = new Emitter<keyof ITerminalOptions>().event;
|
||||||
constructor(testOptions?: Partial<ITerminalOptions>) {
|
constructor(testOptions?: Partial<ITerminalOptions>) {
|
||||||
if (testOptions) {
|
if (testOptions) {
|
||||||
for (const key of Object.keys(testOptions)) {
|
for (const key of Object.keys(testOptions)) {
|
||||||
@@ -197,7 +197,7 @@ export class MockUnicodeService implements IUnicodeService {
|
|||||||
}
|
}
|
||||||
public versions: string[] = [];
|
public versions: string[] = [];
|
||||||
public activeVersion: string = '';
|
public activeVersion: string = '';
|
||||||
public onChange: Event<string> = new Emitter<string>().event;
|
public onChange: IEvent<string> = new Emitter<string>().event;
|
||||||
public wcwidth = (codepoint: number): UnicodeCharWidth => this._provider.wcwidth(codepoint);
|
public wcwidth = (codepoint: number): UnicodeCharWidth => this._provider.wcwidth(codepoint);
|
||||||
public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {
|
public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {
|
||||||
let width = this.wcwidth(codepoint);
|
let width = this.wcwidth(codepoint);
|
||||||
|
|||||||
+6
-6
@@ -9,7 +9,7 @@ import { IBufferSet } from 'common/buffer/Types';
|
|||||||
import { IParams } from 'common/parser/Types';
|
import { IParams } from 'common/parser/Types';
|
||||||
import { ICoreMouseService, ICoreService, IOptionsService, IUnicodeService } from 'common/services/Services';
|
import { ICoreMouseService, ICoreService, IOptionsService, IUnicodeService } from 'common/services/Services';
|
||||||
import { IFunctionIdentifier, ITerminalOptions as IPublicTerminalOptions } from '@xterm/xterm';
|
import { IFunctionIdentifier, ITerminalOptions as IPublicTerminalOptions } from '@xterm/xterm';
|
||||||
import type { Emitter, Event } from 'common/Event';
|
import type { Emitter, IEvent } from 'common/Event';
|
||||||
|
|
||||||
export interface ICoreTerminal {
|
export interface ICoreTerminal {
|
||||||
coreMouseService: ICoreMouseService;
|
coreMouseService: ICoreMouseService;
|
||||||
@@ -68,11 +68,11 @@ export interface ICircularList<T> {
|
|||||||
isFull: boolean;
|
isFull: boolean;
|
||||||
|
|
||||||
onDeleteEmitter: Emitter<IDeleteEvent>;
|
onDeleteEmitter: Emitter<IDeleteEvent>;
|
||||||
onDelete: Event<IDeleteEvent>;
|
onDelete: IEvent<IDeleteEvent>;
|
||||||
onInsertEmitter: Emitter<IInsertEvent>;
|
onInsertEmitter: Emitter<IInsertEvent>;
|
||||||
onInsert: Event<IInsertEvent>;
|
onInsert: IEvent<IInsertEvent>;
|
||||||
onTrimEmitter: Emitter<number>;
|
onTrimEmitter: Emitter<number>;
|
||||||
onTrim: Event<number>;
|
onTrim: IEvent<number>;
|
||||||
|
|
||||||
get(index: number): T | undefined;
|
get(index: number): T | undefined;
|
||||||
set(index: number, value: T): void;
|
set(index: number, value: T): void;
|
||||||
@@ -258,7 +258,7 @@ export interface IMarker extends IDisposable {
|
|||||||
readonly id: number;
|
readonly id: number;
|
||||||
readonly isDisposed: boolean;
|
readonly isDisposed: boolean;
|
||||||
readonly line: number;
|
readonly line: number;
|
||||||
onDispose: Event<void>;
|
onDispose: IEvent<void>;
|
||||||
}
|
}
|
||||||
export interface IModes {
|
export interface IModes {
|
||||||
insertMode: boolean;
|
insertMode: boolean;
|
||||||
@@ -467,7 +467,7 @@ export type IColorEvent = (IColorReportRequest | IColorSetRequest | IColorRestor
|
|||||||
* Calls the parser and handles actions generated by the parser.
|
* Calls the parser and handles actions generated by the parser.
|
||||||
*/
|
*/
|
||||||
export interface IInputHandler {
|
export interface IInputHandler {
|
||||||
onTitleChange: Event<string>;
|
onTitleChange: IEvent<string>;
|
||||||
|
|
||||||
parse(data: string | Uint8Array, promiseResult?: boolean): void | Promise<boolean>;
|
parse(data: string | Uint8Array, promiseResult?: boolean): void | Promise<boolean>;
|
||||||
print(data: Uint32Array, start: number, end: number): void;
|
print(data: Uint32Array, start: number, end: number): void;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { IAttributeData, ICircularList, IBufferLine, ICellData, IMarker, ICharset, IDisposable } from 'common/Types';
|
import { IAttributeData, ICircularList, IBufferLine, ICellData, IMarker, ICharset, IDisposable } from 'common/Types';
|
||||||
import type { Event } from 'common/Event';
|
import type { IEvent } from 'common/Event';
|
||||||
|
|
||||||
// BufferIndex denotes a position in the buffer: [rowIndex, colIndex]
|
// BufferIndex denotes a position in the buffer: [rowIndex, colIndex]
|
||||||
export type BufferIndex = [number, number];
|
export type BufferIndex = [number, number];
|
||||||
@@ -46,7 +46,7 @@ export interface IBufferSet extends IDisposable {
|
|||||||
normal: IBuffer;
|
normal: IBuffer;
|
||||||
active: IBuffer;
|
active: IBuffer;
|
||||||
|
|
||||||
onBufferActivate: Event<{ activeBuffer: IBuffer, inactiveBuffer: IBuffer }>;
|
onBufferActivate: IEvent<{ activeBuffer: IBuffer, inactiveBuffer: IBuffer }>;
|
||||||
|
|
||||||
activateNormalBuffer(): void;
|
activateNormalBuffer(): void;
|
||||||
activateAltBuffer(fillAttr?: IAttributeData): void;
|
activateAltBuffer(fillAttr?: IAttributeData): void;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty, ty
|
|||||||
import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IKittyKeyboardState, IModes, IOscLinkData, IWindowOptions } from 'common/Types';
|
import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IKittyKeyboardState, IModes, IOscLinkData, IWindowOptions } from 'common/Types';
|
||||||
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
||||||
import { createDecorator } from 'common/services/ServiceRegistry';
|
import { createDecorator } from 'common/services/ServiceRegistry';
|
||||||
import type { Emitter, Event } from 'common/Event';
|
import type { Emitter, IEvent } from 'common/Event';
|
||||||
|
|
||||||
export const IBufferService = createDecorator<IBufferService>('BufferService');
|
export const IBufferService = createDecorator<IBufferService>('BufferService');
|
||||||
export interface IBufferService {
|
export interface IBufferService {
|
||||||
@@ -18,8 +18,8 @@ export interface IBufferService {
|
|||||||
readonly buffer: IBuffer;
|
readonly buffer: IBuffer;
|
||||||
readonly buffers: IBufferSet;
|
readonly buffers: IBufferSet;
|
||||||
isUserScrolling: boolean;
|
isUserScrolling: boolean;
|
||||||
onResize: Event<IBufferResizeEvent>;
|
onResize: IEvent<IBufferResizeEvent>;
|
||||||
onScroll: Event<number>;
|
onScroll: IEvent<number>;
|
||||||
scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;
|
scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;
|
||||||
scrollLines(disp: number, suppressScrollEvent?: boolean): void;
|
scrollLines(disp: number, suppressScrollEvent?: boolean): void;
|
||||||
resize(cols: number, rows: number): void;
|
resize(cols: number, rows: number): void;
|
||||||
@@ -59,7 +59,7 @@ export interface ICoreMouseService {
|
|||||||
/**
|
/**
|
||||||
* Event to announce changes in mouse tracking.
|
* Event to announce changes in mouse tracking.
|
||||||
*/
|
*/
|
||||||
onProtocolChange: Event<CoreMouseEventType>;
|
onProtocolChange: IEvent<CoreMouseEventType>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Human readable version of mouse events.
|
* Human readable version of mouse events.
|
||||||
@@ -87,10 +87,10 @@ export interface ICoreService {
|
|||||||
readonly decPrivateModes: IDecPrivateModes;
|
readonly decPrivateModes: IDecPrivateModes;
|
||||||
readonly kittyKeyboard: IKittyKeyboardState;
|
readonly kittyKeyboard: IKittyKeyboardState;
|
||||||
|
|
||||||
readonly onData: Event<string>;
|
readonly onData: IEvent<string>;
|
||||||
readonly onUserInput: Event<void>;
|
readonly onUserInput: IEvent<void>;
|
||||||
readonly onBinary: Event<string>;
|
readonly onBinary: IEvent<string>;
|
||||||
readonly onRequestScrollToBottom: Event<void>;
|
readonly onRequestScrollToBottom: IEvent<void>;
|
||||||
|
|
||||||
reset(): void;
|
reset(): void;
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ export interface IOptionsService {
|
|||||||
/**
|
/**
|
||||||
* Adds an event listener for when any option changes.
|
* Adds an event listener for when any option changes.
|
||||||
*/
|
*/
|
||||||
readonly onOptionChange: Event<keyof ITerminalOptions>;
|
readonly onOptionChange: IEvent<keyof ITerminalOptions>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an event listener for when a specific option changes, this is a convenience method that is
|
* Adds an event listener for when a specific option changes, this is a convenience method that is
|
||||||
@@ -364,7 +364,7 @@ export interface IUnicodeService {
|
|||||||
/** Currently active version. */
|
/** Currently active version. */
|
||||||
activeVersion: string;
|
activeVersion: string;
|
||||||
/** Event triggered, when activate version changed. */
|
/** Event triggered, when activate version changed. */
|
||||||
readonly onChange: Event<string>;
|
readonly onChange: IEvent<string>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unicode version dependent
|
* Unicode version dependent
|
||||||
@@ -389,8 +389,8 @@ export const IDecorationService = createDecorator<IDecorationService>('Decoratio
|
|||||||
export interface IDecorationService extends IDisposable {
|
export interface IDecorationService extends IDisposable {
|
||||||
serviceBrand: undefined;
|
serviceBrand: undefined;
|
||||||
readonly decorations: IterableIterator<IInternalDecoration>;
|
readonly decorations: IterableIterator<IInternalDecoration>;
|
||||||
readonly onDecorationRegistered: Event<IInternalDecoration>;
|
readonly onDecorationRegistered: IEvent<IInternalDecoration>;
|
||||||
readonly onDecorationRemoved: Event<IInternalDecoration>;
|
readonly onDecorationRemoved: IEvent<IInternalDecoration>;
|
||||||
registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;
|
registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;
|
||||||
reset(): void;
|
reset(): void;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';
|
|||||||
import { IBuffer } from 'common/buffer/Types';
|
import { IBuffer } from 'common/buffer/Types';
|
||||||
import { CoreTerminal } from 'common/CoreTerminal';
|
import { CoreTerminal } from 'common/CoreTerminal';
|
||||||
import { IMarker, ITerminalOptions } from 'common/Types';
|
import { IMarker, ITerminalOptions } from 'common/Types';
|
||||||
import { Emitter, Event } from 'common/Event';
|
import { Emitter, EventUtils } from 'common/Event';
|
||||||
|
|
||||||
export class Terminal extends CoreTerminal {
|
export class Terminal extends CoreTerminal {
|
||||||
private readonly _onBell = this._register(new Emitter<void>());
|
private readonly _onBell = this._register(new Emitter<void>());
|
||||||
@@ -49,11 +49,11 @@ export class Terminal extends CoreTerminal {
|
|||||||
// Setup InputHandler listeners
|
// Setup InputHandler listeners
|
||||||
this._register(this._inputHandler.onRequestBell(() => this.bell()));
|
this._register(this._inputHandler.onRequestBell(() => this.bell()));
|
||||||
this._register(this._inputHandler.onRequestReset(() => this.reset()));
|
this._register(this._inputHandler.onRequestReset(() => this.reset()));
|
||||||
this._register(Event.forward(this._inputHandler.onCursorMove, this._onCursorMove));
|
this._register(EventUtils.forward(this._inputHandler.onCursorMove, this._onCursorMove));
|
||||||
this._register(Event.forward(this._inputHandler.onTitleChange, this._onTitleChange));
|
this._register(EventUtils.forward(this._inputHandler.onTitleChange, this._onTitleChange));
|
||||||
this._register(Event.forward(this._inputHandler.onA11yChar, this._onA11yCharEmitter));
|
this._register(EventUtils.forward(this._inputHandler.onA11yChar, this._onA11yCharEmitter));
|
||||||
this._register(Event.forward(this._inputHandler.onA11yTab, this._onA11yTabEmitter));
|
this._register(EventUtils.forward(this._inputHandler.onA11yTab, this._onA11yTabEmitter));
|
||||||
this._register(Event.forward(Event.map(this._inputHandler.onRequestRefreshRows, e => ({ start: e?.start ?? 0, end: e?.end ?? this.rows - 1 })), this._onRender));
|
this._register(EventUtils.forward(EventUtils.map(this._inputHandler.onRequestRefreshRows, e => ({ start: e?.start ?? 0, end: e?.end ?? this.rows - 1 })), this._onRender));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { Terminal as TerminalCore } from 'headless/Terminal';
|
|||||||
import { AddonManager } from 'common/public/AddonManager';
|
import { AddonManager } from 'common/public/AddonManager';
|
||||||
import { ITerminalOptions } from 'common/Types';
|
import { ITerminalOptions } from 'common/Types';
|
||||||
import { Disposable } from 'common/Lifecycle';
|
import { Disposable } from 'common/Lifecycle';
|
||||||
import type { Event } from 'common/Event';
|
import type { IEvent } from 'common/Event';
|
||||||
/**
|
/**
|
||||||
* The set of options that only have an effect when set in the Terminal constructor.
|
* The set of options that only have an effect when set in the Terminal constructor.
|
||||||
*/
|
*/
|
||||||
@@ -72,16 +72,16 @@ export class Terminal extends Disposable implements ITerminalApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public get onBell(): Event<void> { return this._core.onBell; }
|
public get onBell(): IEvent<void> { return this._core.onBell; }
|
||||||
public get onBinary(): Event<string> { return this._core.onBinary; }
|
public get onBinary(): IEvent<string> { return this._core.onBinary; }
|
||||||
public get onCursorMove(): Event<void> { return this._core.onCursorMove; }
|
public get onCursorMove(): IEvent<void> { return this._core.onCursorMove; }
|
||||||
public get onData(): Event<string> { return this._core.onData; }
|
public get onData(): IEvent<string> { return this._core.onData; }
|
||||||
public get onLineFeed(): Event<void> { return this._core.onLineFeed; }
|
public get onLineFeed(): IEvent<void> { return this._core.onLineFeed; }
|
||||||
public get onRender(): Event<{ start: number, end: number }> { return this._core.onRender; }
|
public get onRender(): IEvent<{ start: number, end: number }> { return this._core.onRender; }
|
||||||
public get onResize(): Event<{ cols: number, rows: number }> { return this._core.onResize; }
|
public get onResize(): IEvent<{ cols: number, rows: number }> { return this._core.onResize; }
|
||||||
public get onScroll(): Event<number> { return this._core.onScroll; }
|
public get onScroll(): IEvent<number> { return this._core.onScroll; }
|
||||||
public get onTitleChange(): Event<string> { return this._core.onTitleChange; }
|
public get onTitleChange(): IEvent<string> { return this._core.onTitleChange; }
|
||||||
public get onWriteParsed(): Event<void> { return this._core.onWriteParsed; }
|
public get onWriteParsed(): IEvent<void> { return this._core.onWriteParsed; }
|
||||||
|
|
||||||
public get parser(): IParser {
|
public get parser(): IParser {
|
||||||
if (!this._parser) {
|
if (!this._parser) {
|
||||||
|
|||||||
Reference in New Issue
Block a user