Remove IEvent and runAndSubscribe
This commit is contained in:
@@ -4,8 +4,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { IDisposable } from 'common/Types';
|
import { IDisposable } from 'common/Types';
|
||||||
import { IEvent } from 'common/EventEmitter';
|
|
||||||
import { IRenderDimensions } from 'browser/renderer/shared/Types';
|
import { IRenderDimensions } from 'browser/renderer/shared/Types';
|
||||||
|
import type { Event } from 'vs/base/common/event';
|
||||||
|
|
||||||
export interface IRequestRedrawEvent {
|
export interface IRequestRedrawEvent {
|
||||||
start: number;
|
start: number;
|
||||||
@@ -23,7 +23,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: IEvent<IRequestRedrawEvent>;
|
readonly onRequestRedraw: Event<IRequestRedrawEvent>;
|
||||||
|
|
||||||
handleDevicePixelRatioChange(): void;
|
handleDevicePixelRatioChange(): void;
|
||||||
handleResize(cols: number, rows: number): void;
|
handleResize(cols: number, rows: number): void;
|
||||||
@@ -42,7 +42,7 @@ export interface IRenderLayer extends IDisposable {
|
|||||||
readonly canvas: HTMLCanvasElement;
|
readonly canvas: HTMLCanvasElement;
|
||||||
readonly cacheCanvas: HTMLCanvasElement;
|
readonly cacheCanvas: HTMLCanvasElement;
|
||||||
|
|
||||||
readonly onAddTextureAtlasCanvas: IEvent<HTMLCanvasElement>;
|
readonly onAddTextureAtlasCanvas: Event<HTMLCanvasElement>;
|
||||||
/**
|
/**
|
||||||
* Called when the terminal loses focus.
|
* Called when the terminal loses focus.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, ILinkPr
|
|||||||
import { ThemeService } from 'browser/services/ThemeService';
|
import { ThemeService } from 'browser/services/ThemeService';
|
||||||
import { channels, color } from 'common/Color';
|
import { channels, color } from 'common/Color';
|
||||||
import { CoreTerminal } from 'common/CoreTerminal';
|
import { CoreTerminal } from 'common/CoreTerminal';
|
||||||
import { IEvent, forwardEvent } from 'common/EventEmitter';
|
import { forwardEvent } from 'common/EventEmitter';
|
||||||
import { MutableDisposable, toDisposable } from 'common/Lifecycle';
|
import { MutableDisposable, toDisposable } from 'common/Lifecycle';
|
||||||
import * as Browser from 'common/Platform';
|
import * as Browser from 'common/Platform';
|
||||||
import { ColorRequestType, CoreMouseAction, CoreMouseButton, CoreMouseEventType, IColorEvent, ITerminalOptions, KeyboardResultType, SpecialColorIndex } from 'common/Types';
|
import { ColorRequestType, CoreMouseAction, CoreMouseButton, CoreMouseEventType, IColorEvent, ITerminalOptions, KeyboardResultType, SpecialColorIndex } from 'common/Types';
|
||||||
@@ -58,7 +58,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 } from 'vs/base/common/event';
|
import { Emitter, type Event } from 'vs/base/common/event';
|
||||||
|
|
||||||
export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
|
export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
|
||||||
public textarea: HTMLTextAreaElement | undefined;
|
public textarea: HTMLTextAreaElement | undefined;
|
||||||
@@ -136,15 +136,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(): IEvent<void> { return this._onFocus.event; }
|
public get onFocus(): Event<void> { return this._onFocus.event; }
|
||||||
private _onBlur = this.register(new Emitter<void>());
|
private _onBlur = this.register(new Emitter<void>());
|
||||||
public get onBlur(): IEvent<void> { return this._onBlur.event; }
|
public get onBlur(): Event<void> { return this._onBlur.event; }
|
||||||
private _onA11yCharEmitter = this.register(new Emitter<string>());
|
private _onA11yCharEmitter = this.register(new Emitter<string>());
|
||||||
public get onA11yChar(): IEvent<string> { return this._onA11yCharEmitter.event; }
|
public get onA11yChar(): Event<string> { return this._onA11yCharEmitter.event; }
|
||||||
private _onA11yTabEmitter = this.register(new Emitter<number>());
|
private _onA11yTabEmitter = this.register(new Emitter<number>());
|
||||||
public get onA11yTab(): IEvent<number> { return this._onA11yTabEmitter.event; }
|
public get onA11yTab(): Event<number> { return this._onA11yTabEmitter.event; }
|
||||||
private _onWillOpen = this.register(new Emitter<HTMLElement>());
|
private _onWillOpen = this.register(new Emitter<HTMLElement>());
|
||||||
public get onWillOpen(): IEvent<HTMLElement> { return this._onWillOpen.event; }
|
public get onWillOpen(): Event<HTMLElement> { return this._onWillOpen.event; }
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
options: Partial<ITerminalOptions> = {}
|
options: Partial<ITerminalOptions> = {}
|
||||||
@@ -673,7 +673,7 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
|
|||||||
* Note: 'mousedown' currently is "always on" and not managed
|
* Note: 'mousedown' currently is "always on" and not managed
|
||||||
* by onProtocolChange.
|
* by onProtocolChange.
|
||||||
*/
|
*/
|
||||||
const requestedEvents: { [key: string]: ((ev: Event) => void) | null } = {
|
const requestedEvents: { [key: string]: ((ev: MouseEvent | WheelEvent) => void) | null } = {
|
||||||
mouseup: null,
|
mouseup: null,
|
||||||
wheel: null,
|
wheel: null,
|
||||||
mousedrag: null,
|
mousedrag: null,
|
||||||
@@ -1293,7 +1293,7 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove cancel function and cancelEvents option
|
// TODO: Remove cancel function and cancelEvents option
|
||||||
public cancel(ev: Event, force?: boolean): boolean | undefined {
|
public cancel(ev: MouseEvent | WheelEvent | KeyboardEvent | InputEvent, force?: boolean): boolean | undefined {
|
||||||
if (!this.options.cancelEvents && !force) {
|
if (!this.options.cancelEvents && !force) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { IDisposable, IMarker, ILinkProvider, IDecorationOptions, IDecoration } from '@xterm/xterm';
|
import { IDisposable, IMarker, ILinkProvider, IDecorationOptions, IDecoration } from '@xterm/xterm';
|
||||||
import { IEvent } from 'common/EventEmitter';
|
|
||||||
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IMouseService, IRenderService, ISelectionService, IThemeService } from 'browser/services/Services';
|
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IMouseService, IRenderService, ISelectionService, IThemeService } from 'browser/services/Services';
|
||||||
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/shared/Types';
|
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/shared/Types';
|
||||||
import { IColorSet, ITerminal, ILinkifier2, IBrowser, IViewport, ICompositionHelper, CharacterJoinerHandler, IBufferRange, ReadonlyColorSet, IBufferElementProvider } from 'browser/Types';
|
import { IColorSet, ITerminal, ILinkifier2, IBrowser, IViewport, ICompositionHelper, CharacterJoinerHandler, IBufferRange, ReadonlyColorSet, IBufferElementProvider } from 'browser/Types';
|
||||||
@@ -19,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 } from 'vs/base/common/event';
|
import { Emitter, type Event } from 'vs/base/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; }
|
||||||
@@ -31,23 +30,23 @@ export class TestTerminal extends CoreBrowserTerminal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class MockTerminal implements ITerminal {
|
export class MockTerminal implements ITerminal {
|
||||||
public onBlur!: IEvent<void>;
|
public onBlur!: Event<void>;
|
||||||
public onFocus!: IEvent<void>;
|
public onFocus!: Event<void>;
|
||||||
public onA11yChar!: IEvent<string>;
|
public onA11yChar!: Event<string>;
|
||||||
public onWriteParsed!: IEvent<void>;
|
public onWriteParsed!: Event<void>;
|
||||||
public onA11yTab!: IEvent<number>;
|
public onA11yTab!: Event<number>;
|
||||||
public onCursorMove!: IEvent<void>;
|
public onCursorMove!: Event<void>;
|
||||||
public onLineFeed!: IEvent<void>;
|
public onLineFeed!: Event<void>;
|
||||||
public onSelectionChange!: IEvent<void>;
|
public onSelectionChange!: Event<void>;
|
||||||
public onData!: IEvent<string>;
|
public onData!: Event<string>;
|
||||||
public onBinary!: IEvent<string>;
|
public onBinary!: Event<string>;
|
||||||
public onTitleChange!: IEvent<string>;
|
public onTitleChange!: Event<string>;
|
||||||
public onBell!: IEvent<void>;
|
public onBell!: Event<void>;
|
||||||
public onScroll!: IEvent<number>;
|
public onScroll!: Event<number>;
|
||||||
public onWillOpen!: IEvent<HTMLElement>;
|
public onWillOpen!: Event<HTMLElement>;
|
||||||
public onKey!: IEvent<{ key: string, domEvent: KeyboardEvent }>;
|
public onKey!: Event<{ key: string, domEvent: KeyboardEvent }>;
|
||||||
public onRender!: IEvent<{ start: number, end: number }>;
|
public onRender!: Event<{ start: number, end: number }>;
|
||||||
public onResize!: IEvent<{ cols: number, rows: number }>;
|
public onResize!: Event<{ cols: number, rows: number }>;
|
||||||
public markers!: IMarker[];
|
public markers!: IMarker[];
|
||||||
public linkifier: ILinkifier2 | undefined;
|
public linkifier: ILinkifier2 | undefined;
|
||||||
public coreMouseService!: ICoreMouseService;
|
public coreMouseService!: ICoreMouseService;
|
||||||
@@ -194,7 +193,7 @@ export class MockTerminal implements ITerminal {
|
|||||||
public scrollToRow(absoluteRow: number): number {
|
public scrollToRow(absoluteRow: number): number {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
public cancel(ev: Event, force?: boolean): void {
|
public cancel(ev: MouseEvent | WheelEvent | KeyboardEvent | InputEvent, force?: boolean): void {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
public log(text: string): void {
|
public log(text: string): void {
|
||||||
@@ -268,9 +267,9 @@ export class MockBuffer implements IBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class MockRenderer implements IRenderer {
|
export class MockRenderer implements IRenderer {
|
||||||
public onRequestRedraw!: IEvent<IRequestRedrawEvent>;
|
public onRequestRedraw!: Event<IRequestRedrawEvent>;
|
||||||
public onCanvasResize!: IEvent<{ width: number, height: number }>;
|
public onCanvasResize!: Event<{ width: number, height: number }>;
|
||||||
public onRender!: IEvent<{ start: number, end: number }>;
|
public onRender!: Event<{ start: number, end: number }>;
|
||||||
public dispose(): void {
|
public dispose(): void {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
@@ -373,7 +372,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: IEvent<void> = new Emitter<void>().event;
|
public onCharSizeChange: Event<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 {}
|
||||||
}
|
}
|
||||||
@@ -391,10 +390,10 @@ export class MockMouseService implements IMouseService {
|
|||||||
|
|
||||||
export class MockRenderService implements IRenderService {
|
export class MockRenderService implements IRenderService {
|
||||||
public serviceBrand: undefined;
|
public serviceBrand: undefined;
|
||||||
public onDimensionsChange: IEvent<IRenderDimensions> = new Emitter<IRenderDimensions>().event;
|
public onDimensionsChange: Event<IRenderDimensions> = new Emitter<IRenderDimensions>().event;
|
||||||
public onRenderedViewportChange: IEvent<{ start: number, end: number }, void> = new Emitter<{ start: number, end: number }>().event;
|
public onRenderedViewportChange: Event<{ start: number, end: number }> = new Emitter<{ start: number, end: number }>().event;
|
||||||
public onRender: IEvent<{ start: number, end: number }, void> = new Emitter<{ start: number, end: number }>().event;
|
public onRender: Event<{ start: number, end: number }> = new Emitter<{ start: number, end: number }>().event;
|
||||||
public onRefreshRequest: IEvent<{ start: number, end: number}, void> = new Emitter<{ start: number, end: number }>().event;
|
public onRefreshRequest: Event<{ 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
@@ -3,11 +3,11 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IEvent } from 'common/EventEmitter';
|
|
||||||
import { CharData, IColor, ICoreTerminal, ITerminalOptions } from 'common/Types';
|
import { CharData, IColor, ICoreTerminal, ITerminalOptions } from 'common/Types';
|
||||||
import { IBuffer } from 'common/buffer/Types';
|
import { IBuffer } from 'common/buffer/Types';
|
||||||
import { IDisposable, Terminal as ITerminalApi } from '@xterm/xterm';
|
import { IDisposable, Terminal as ITerminalApi } from '@xterm/xterm';
|
||||||
import { channels, css } from 'common/Color';
|
import { channels, css } from 'common/Color';
|
||||||
|
import type { Event } from 'vs/base/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.
|
||||||
@@ -21,13 +21,13 @@ export interface ITerminal extends InternalPassthroughApis, ICoreTerminal {
|
|||||||
linkifier: ILinkifier2 | undefined;
|
linkifier: ILinkifier2 | undefined;
|
||||||
options: Required<ITerminalOptions>;
|
options: Required<ITerminalOptions>;
|
||||||
|
|
||||||
onBlur: IEvent<void>;
|
onBlur: Event<void>;
|
||||||
onFocus: IEvent<void>;
|
onFocus: Event<void>;
|
||||||
onA11yChar: IEvent<string>;
|
onA11yChar: Event<string>;
|
||||||
onA11yTab: IEvent<number>;
|
onA11yTab: Event<number>;
|
||||||
onWillOpen: IEvent<HTMLElement>;
|
onWillOpen: Event<HTMLElement>;
|
||||||
|
|
||||||
cancel(ev: Event, force?: boolean): boolean | void;
|
cancel(ev: MouseEvent | WheelEvent | KeyboardEvent | InputEvent, force?: boolean): boolean | void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CustomKeyEventHandler = (event: KeyboardEvent) => boolean;
|
export type CustomKeyEventHandler = (event: KeyboardEvent) => boolean;
|
||||||
@@ -98,7 +98,7 @@ export interface IPartialColorSet {
|
|||||||
|
|
||||||
export interface IViewport extends IDisposable {
|
export interface IViewport extends IDisposable {
|
||||||
scrollBarWidth: number;
|
scrollBarWidth: number;
|
||||||
readonly onRequestScrollLines: IEvent<{ amount: number, suppressScrollEvent: boolean }>;
|
readonly onRequestScrollLines: Event<{ 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 };
|
||||||
@@ -128,8 +128,8 @@ export interface ILinkWithState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ILinkifier2 extends IDisposable {
|
export interface ILinkifier2 extends IDisposable {
|
||||||
onShowLinkUnderline: IEvent<ILinkifierEvent>;
|
onShowLinkUnderline: Event<ILinkifierEvent>;
|
||||||
onHideLinkUnderline: IEvent<ILinkifierEvent>;
|
onHideLinkUnderline: Event<ILinkifierEvent>;
|
||||||
readonly currentLink: ILinkWithState | undefined;
|
readonly currentLink: ILinkWithState | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,13 @@
|
|||||||
|
|
||||||
import { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
|
import { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
|
||||||
import { ViewportConstants } from 'browser/shared/Constants';
|
import { ViewportConstants } from 'browser/shared/Constants';
|
||||||
import { runAndSubscribe } from 'common/EventEmitter';
|
|
||||||
import { Disposable, toDisposable } from 'common/Lifecycle';
|
import { Disposable, toDisposable } from 'common/Lifecycle';
|
||||||
import { IBufferService, ICoreMouseService, IOptionsService } from 'common/services/Services';
|
import { IBufferService, ICoreMouseService, IOptionsService } from 'common/services/Services';
|
||||||
import { CoreMouseEventType } from 'common/Types';
|
import { CoreMouseEventType } from 'common/Types';
|
||||||
import { scheduleAtNextAnimationFrame } from 'vs/base/browser/dom';
|
import { 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 } from 'vs/base/common/event';
|
import { Emitter, Event } from 'vs/base/common/event';
|
||||||
import { Scrollable, ScrollbarVisibility, type ScrollEvent } from 'vs/base/common/scrollable';
|
import { Scrollable, ScrollbarVisibility, type ScrollEvent } from 'vs/base/common/scrollable';
|
||||||
|
|
||||||
export class Viewport extends Disposable {
|
export class Viewport extends Disposable {
|
||||||
@@ -71,7 +70,7 @@ export class Viewport extends Disposable {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
this._scrollableElement.setScrollDimensions({ height: 0, scrollHeight: 0 });
|
this._scrollableElement.setScrollDimensions({ height: 0, scrollHeight: 0 });
|
||||||
this.register(runAndSubscribe(themeService.onChangeColors, () => {
|
this.register(Event.runAndSubscribe(themeService.onChangeColors, () => {
|
||||||
this._scrollableElement.getDomNode().style.backgroundColor = themeService.colors.background.css;
|
this._scrollableElement.getDomNode().style.backgroundColor = themeService.colors.background.css;
|
||||||
}));
|
}));
|
||||||
element.appendChild(this._scrollableElement.getDomNode());
|
element.appendChild(this._scrollableElement.getDomNode());
|
||||||
@@ -80,7 +79,7 @@ export class Viewport extends Disposable {
|
|||||||
this._styleElement = coreBrowserService.window.document.createElement('style');
|
this._styleElement = coreBrowserService.window.document.createElement('style');
|
||||||
screenElement.appendChild(this._styleElement);
|
screenElement.appendChild(this._styleElement);
|
||||||
this.register(toDisposable(() => this._styleElement.remove()));
|
this.register(toDisposable(() => this._styleElement.remove()));
|
||||||
this.register(runAndSubscribe(themeService.onChangeColors, () => {
|
this.register(Event.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};`,
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
import * as Strings from 'browser/LocalizableStrings';
|
import * as Strings from 'browser/LocalizableStrings';
|
||||||
import { CoreBrowserTerminal as TerminalCore } from 'browser/CoreBrowserTerminal';
|
import { CoreBrowserTerminal as TerminalCore } from 'browser/CoreBrowserTerminal';
|
||||||
import { IBufferRange, ITerminal } from 'browser/Types';
|
import { IBufferRange, ITerminal } from 'browser/Types';
|
||||||
import { IEvent } from 'common/EventEmitter';
|
|
||||||
import { Disposable } from 'common/Lifecycle';
|
import { Disposable } from 'common/Lifecycle';
|
||||||
import { ITerminalOptions } from 'common/Types';
|
import { ITerminalOptions } from 'common/Types';
|
||||||
import { AddonManager } from 'common/public/AddonManager';
|
import { AddonManager } from 'common/public/AddonManager';
|
||||||
@@ -14,6 +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, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from '@xterm/xterm';
|
import { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from '@xterm/xterm';
|
||||||
|
import type { Event } from 'vs/base/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,18 +68,18 @@ export class Terminal extends Disposable implements ITerminalApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public get onBell(): IEvent<void> { return this._core.onBell; }
|
public get onBell(): Event<void> { return this._core.onBell; }
|
||||||
public get onBinary(): IEvent<string> { return this._core.onBinary; }
|
public get onBinary(): Event<string> { return this._core.onBinary; }
|
||||||
public get onCursorMove(): IEvent<void> { return this._core.onCursorMove; }
|
public get onCursorMove(): Event<void> { return this._core.onCursorMove; }
|
||||||
public get onData(): IEvent<string> { return this._core.onData; }
|
public get onData(): Event<string> { return this._core.onData; }
|
||||||
public get onKey(): IEvent<{ key: string, domEvent: KeyboardEvent }> { return this._core.onKey; }
|
public get onKey(): Event<{ key: string, domEvent: KeyboardEvent }> { return this._core.onKey; }
|
||||||
public get onLineFeed(): IEvent<void> { return this._core.onLineFeed; }
|
public get onLineFeed(): Event<void> { return this._core.onLineFeed; }
|
||||||
public get onRender(): IEvent<{ start: number, end: number }> { return this._core.onRender; }
|
public get onRender(): Event<{ start: number, end: number }> { return this._core.onRender; }
|
||||||
public get onResize(): IEvent<{ cols: number, rows: number }> { return this._core.onResize; }
|
public get onResize(): Event<{ cols: number, rows: number }> { return this._core.onResize; }
|
||||||
public get onScroll(): IEvent<number> { return this._core.onScroll; }
|
public get onScroll(): Event<number> { return this._core.onScroll; }
|
||||||
public get onSelectionChange(): IEvent<void> { return this._core.onSelectionChange; }
|
public get onSelectionChange(): Event<void> { return this._core.onSelectionChange; }
|
||||||
public get onTitleChange(): IEvent<string> { return this._core.onTitleChange; }
|
public get onTitleChange(): Event<string> { return this._core.onTitleChange; }
|
||||||
public get onWriteParsed(): IEvent<void> { return this._core.onWriteParsed; }
|
public get onWriteParsed(): Event<void> { return this._core.onWriteParsed; }
|
||||||
|
|
||||||
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 { FontWeight, Terminal } from '@xterm/xterm';
|
import { FontWeight, Terminal } from '@xterm/xterm';
|
||||||
import { IColorSet, ITerminal } from 'browser/Types';
|
import { IColorSet, ITerminal } from 'browser/Types';
|
||||||
import { IDisposable } from 'common/Types';
|
import { IDisposable } from 'common/Types';
|
||||||
import { IEvent } from 'common/EventEmitter';
|
import type { Event } from 'vs/base/common/event';
|
||||||
|
|
||||||
export interface ICharAtlasConfig {
|
export interface ICharAtlasConfig {
|
||||||
customGlyphs: boolean;
|
customGlyphs: boolean;
|
||||||
@@ -71,7 +71,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: IEvent<IRequestRedrawEvent>;
|
readonly onRequestRedraw: Event<IRequestRedrawEvent>;
|
||||||
|
|
||||||
dispose(): void;
|
dispose(): void;
|
||||||
handleDevicePixelRatioChange(): void;
|
handleDevicePixelRatioChange(): void;
|
||||||
@@ -89,8 +89,8 @@ export interface IRenderer extends IDisposable {
|
|||||||
export interface ITextureAtlas extends IDisposable {
|
export interface ITextureAtlas extends IDisposable {
|
||||||
readonly pages: { canvas: HTMLCanvasElement, version: number }[];
|
readonly pages: { canvas: HTMLCanvasElement, version: number }[];
|
||||||
|
|
||||||
onAddTextureAtlasCanvas: IEvent<HTMLCanvasElement>;
|
onAddTextureAtlasCanvas: Event<HTMLCanvasElement>;
|
||||||
onRemoveTextureAtlasCanvas: IEvent<HTMLCanvasElement>;
|
onRemoveTextureAtlasCanvas: Event<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.
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IEvent } from 'common/EventEmitter';
|
|
||||||
import { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';
|
import { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';
|
||||||
import { IColorSet, ILink, ReadonlyColorSet } from 'browser/Types';
|
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 } from 'common/Types';
|
import { AllColorIndex, IDisposable } from 'common/Types';
|
||||||
|
import type { Event } from 'vs/base/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: IEvent<void>;
|
readonly onCharSizeChange: Event<void>;
|
||||||
|
|
||||||
measure(): void;
|
measure(): void;
|
||||||
}
|
}
|
||||||
@@ -29,8 +29,8 @@ export interface ICoreBrowserService {
|
|||||||
|
|
||||||
readonly isFocused: boolean;
|
readonly isFocused: boolean;
|
||||||
|
|
||||||
readonly onDprChange: IEvent<number>;
|
readonly onDprChange: Event<number>;
|
||||||
readonly onWindowChange: IEvent<Window & typeof globalThis>;
|
readonly onWindowChange: Event<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: IEvent<IRenderDimensions>;
|
onDimensionsChange: Event<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: IEvent<{ start: number, end: number }>;
|
onRenderedViewportChange: Event<{ start: number, end: number }>;
|
||||||
/**
|
/**
|
||||||
* Fires on render
|
* Fires on render
|
||||||
*/
|
*/
|
||||||
onRender: IEvent<{ start: number, end: number }>;
|
onRender: Event<{ start: number, end: number }>;
|
||||||
onRefreshRequest: IEvent<{ start: number, end: number }>;
|
onRefreshRequest: Event<{ 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: IEvent<string>;
|
readonly onLinuxMouseSelection: Event<string>;
|
||||||
readonly onRequestRedraw: IEvent<ISelectionRequestRedrawEvent>;
|
readonly onRequestRedraw: Event<ISelectionRequestRedrawEvent>;
|
||||||
readonly onRequestScrollLines: IEvent<ISelectionRequestScrollLinesEvent>;
|
readonly onRequestScrollLines: Event<ISelectionRequestScrollLinesEvent>;
|
||||||
readonly onSelectionChange: IEvent<void>;
|
readonly onSelectionChange: Event<void>;
|
||||||
|
|
||||||
disable(): void;
|
disable(): void;
|
||||||
enable(): void;
|
enable(): void;
|
||||||
@@ -136,7 +136,7 @@ export interface IThemeService {
|
|||||||
|
|
||||||
readonly colors: ReadonlyColorSet;
|
readonly colors: ReadonlyColorSet;
|
||||||
|
|
||||||
readonly onChangeColors: IEvent<ReadonlyColorSet>;
|
readonly onChangeColors: Event<ReadonlyColorSet>;
|
||||||
|
|
||||||
restoreColor(slot?: AllColorIndex): void;
|
restoreColor(slot?: AllColorIndex): void;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import { BufferService, MINIMUM_COLS, MINIMUM_ROWS } from 'common/services/Buffe
|
|||||||
import { OptionsService } from 'common/services/OptionsService';
|
import { OptionsService } from 'common/services/OptionsService';
|
||||||
import { IDisposable, IAttributeData, ICoreTerminal, IScrollEvent } from 'common/Types';
|
import { IDisposable, IAttributeData, ICoreTerminal, IScrollEvent } from 'common/Types';
|
||||||
import { CoreService } from 'common/services/CoreService';
|
import { CoreService } from 'common/services/CoreService';
|
||||||
import { IEvent, forwardEvent } from 'common/EventEmitter';
|
import { forwardEvent } from 'common/EventEmitter';
|
||||||
import { CoreMouseService } from 'common/services/CoreMouseService';
|
import { CoreMouseService } from 'common/services/CoreMouseService';
|
||||||
import { UnicodeService } from 'common/services/UnicodeService';
|
import { UnicodeService } from 'common/services/UnicodeService';
|
||||||
import { CharsetService } from 'common/services/CharsetService';
|
import { CharsetService } from 'common/services/CharsetService';
|
||||||
@@ -39,7 +39,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 } from 'vs/base/common/event';
|
import { Emitter, type Event } from 'vs/base/common/event';
|
||||||
|
|
||||||
// Only trigger this warning a single time per session
|
// Only trigger this warning a single time per session
|
||||||
let hasWriteSyncWarnHappened = false;
|
let hasWriteSyncWarnHappened = false;
|
||||||
@@ -77,7 +77,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(): IEvent<number, void> {
|
public get onScroll(): Event<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 => {
|
||||||
|
|||||||
@@ -6,16 +6,6 @@
|
|||||||
import { IDisposable } from 'common/Types';
|
import { IDisposable } from 'common/Types';
|
||||||
import type { Emitter, Event } from 'vs/base/common/event';
|
import type { Emitter, Event } from 'vs/base/common/event';
|
||||||
|
|
||||||
export interface IEvent<T, U = void> {
|
export function forwardEvent<T>(from: Event<T>, to: Emitter<T>): IDisposable {
|
||||||
(listener: (arg1: T, arg2: U) => any): IDisposable;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function forwardEvent<T>(from: IEvent<T> | Event<T>, to: Emitter<T>): IDisposable {
|
|
||||||
return from(e => to.fire(e));
|
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));
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
import { IBufferService, ICoreService, ILogService, IOptionsService, ITerminalOptions, ICoreMouseService, ICharsetService, UnicodeCharProperties, UnicodeCharWidth, IUnicodeService, IUnicodeVersionProvider, LogLevelEnum, IDecorationService, IInternalDecoration, IOscLinkService } from 'common/services/Services';
|
import { IBufferService, ICoreService, ILogService, IOptionsService, ITerminalOptions, ICoreMouseService, ICharsetService, UnicodeCharProperties, UnicodeCharWidth, IUnicodeService, IUnicodeVersionProvider, LogLevelEnum, IDecorationService, IInternalDecoration, IOscLinkService } from 'common/services/Services';
|
||||||
import { UnicodeService } from 'common/services/UnicodeService';
|
import { UnicodeService } from 'common/services/UnicodeService';
|
||||||
import { IEvent } from 'common/EventEmitter';
|
|
||||||
import { clone } from 'common/Clone';
|
import { clone } from 'common/Clone';
|
||||||
import { DEFAULT_OPTIONS } from 'common/services/OptionsService';
|
import { DEFAULT_OPTIONS } from 'common/services/OptionsService';
|
||||||
import { IBufferSet, IBuffer } from 'common/buffer/Types';
|
import { IBufferSet, IBuffer } from 'common/buffer/Types';
|
||||||
@@ -13,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 } from 'vs/base/common/event';
|
import { Emitter, type Event } from 'vs/base/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: IEvent<{ cols: number, rows: number }> = new Emitter<{ cols: number, rows: number }>().event;
|
public onResize: Event<{ cols: number, rows: number }> = new Emitter<{ cols: number, rows: number }>().event;
|
||||||
public onScroll: IEvent<number> = new Emitter<number>().event;
|
public onScroll: Event<number> = new Emitter<number>().event;
|
||||||
public isUserScrolling: boolean = false;
|
public isUserScrolling: boolean = false;
|
||||||
constructor(
|
constructor(
|
||||||
public cols: number,
|
public cols: number,
|
||||||
@@ -63,7 +62,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: IEvent<CoreMouseEventType> = new Emitter<CoreMouseEventType>().event;
|
public onProtocolChange: Event<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.');
|
||||||
}
|
}
|
||||||
@@ -95,10 +94,10 @@ export class MockCoreService implements ICoreService {
|
|||||||
sendFocus: false,
|
sendFocus: false,
|
||||||
wraparound: true
|
wraparound: true
|
||||||
};
|
};
|
||||||
public onData: IEvent<string> = new Emitter<string>().event;
|
public onData: Event<string> = new Emitter<string>().event;
|
||||||
public onUserInput: IEvent<void> = new Emitter<void>().event;
|
public onUserInput: Event<void> = new Emitter<void>().event;
|
||||||
public onBinary: IEvent<string> = new Emitter<string>().event;
|
public onBinary: Event<string> = new Emitter<string>().event;
|
||||||
public onRequestScrollToBottom: IEvent<void> = new Emitter<void>().event;
|
public onRequestScrollToBottom: Event<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 { }
|
||||||
@@ -118,7 +117,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: IEvent<keyof ITerminalOptions> = new Emitter<keyof ITerminalOptions>().event;
|
public onOptionChange: Event<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)) {
|
||||||
@@ -170,7 +169,7 @@ export class MockUnicodeService implements IUnicodeService {
|
|||||||
}
|
}
|
||||||
public versions: string[] = [];
|
public versions: string[] = [];
|
||||||
public activeVersion: string = '';
|
public activeVersion: string = '';
|
||||||
public onChange: IEvent<string> = new Emitter<string>().event;
|
public onChange: Event<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
-7
@@ -4,13 +4,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { IDeleteEvent, IInsertEvent } from 'common/CircularList';
|
import { IDeleteEvent, IInsertEvent } from 'common/CircularList';
|
||||||
import { IEvent } from 'common/EventEmitter';
|
|
||||||
import { Attributes, UnderlineStyle } from 'common/buffer/Constants'; // eslint-disable-line no-unused-vars
|
import { Attributes, UnderlineStyle } from 'common/buffer/Constants'; // eslint-disable-line no-unused-vars
|
||||||
import { IBufferSet } from 'common/buffer/Types';
|
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 } from 'vs/base/common/event';
|
import type { Emitter, Event } from 'vs/base/common/event';
|
||||||
|
|
||||||
export interface ICoreTerminal {
|
export interface ICoreTerminal {
|
||||||
coreMouseService: ICoreMouseService;
|
coreMouseService: ICoreMouseService;
|
||||||
@@ -69,11 +68,11 @@ export interface ICircularList<T> {
|
|||||||
isFull: boolean;
|
isFull: boolean;
|
||||||
|
|
||||||
onDeleteEmitter: Emitter<IDeleteEvent>;
|
onDeleteEmitter: Emitter<IDeleteEvent>;
|
||||||
onDelete: IEvent<IDeleteEvent>;
|
onDelete: Event<IDeleteEvent>;
|
||||||
onInsertEmitter: Emitter<IInsertEvent>;
|
onInsertEmitter: Emitter<IInsertEvent>;
|
||||||
onInsert: IEvent<IInsertEvent>;
|
onInsert: Event<IInsertEvent>;
|
||||||
onTrimEmitter: Emitter<number>;
|
onTrimEmitter: Emitter<number>;
|
||||||
onTrim: IEvent<number>;
|
onTrim: Event<number>;
|
||||||
|
|
||||||
get(index: number): T | undefined;
|
get(index: number): T | undefined;
|
||||||
set(index: number, value: T): void;
|
set(index: number, value: T): void;
|
||||||
@@ -259,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: IEvent<void>;
|
onDispose: Event<void>;
|
||||||
}
|
}
|
||||||
export interface IModes {
|
export interface IModes {
|
||||||
insertMode: boolean;
|
insertMode: boolean;
|
||||||
@@ -447,7 +446,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: IEvent<string>;
|
onTitleChange: Event<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 { IEvent } from 'common/EventEmitter';
|
import type { Event } from 'vs/base/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];
|
||||||
@@ -42,7 +42,7 @@ export interface IBufferSet extends IDisposable {
|
|||||||
normal: IBuffer;
|
normal: IBuffer;
|
||||||
active: IBuffer;
|
active: IBuffer;
|
||||||
|
|
||||||
onBufferActivate: IEvent<{ activeBuffer: IBuffer, inactiveBuffer: IBuffer }>;
|
onBufferActivate: Event<{ activeBuffer: IBuffer, inactiveBuffer: IBuffer }>;
|
||||||
|
|
||||||
activateNormalBuffer(): void;
|
activateNormalBuffer(): void;
|
||||||
activateAltBuffer(fillAttr?: IAttributeData): void;
|
activateAltBuffer(fillAttr?: IAttributeData): void;
|
||||||
|
|||||||
@@ -4,11 +4,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty } from '@xterm/xterm';
|
import { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty } from '@xterm/xterm';
|
||||||
import { IEvent } from 'common/EventEmitter';
|
|
||||||
import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IModes, IOscLinkData, IWindowOptions } from 'common/Types';
|
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 { IBuffer, IBufferSet } from 'common/buffer/Types';
|
||||||
import { createDecorator } from 'common/services/ServiceRegistry';
|
import { createDecorator } from 'common/services/ServiceRegistry';
|
||||||
import type { Emitter } from 'vs/base/common/event';
|
import type { Emitter, Event } from 'vs/base/common/event';
|
||||||
|
|
||||||
export const IBufferService = createDecorator<IBufferService>('BufferService');
|
export const IBufferService = createDecorator<IBufferService>('BufferService');
|
||||||
export interface IBufferService {
|
export interface IBufferService {
|
||||||
@@ -19,8 +18,8 @@ export interface IBufferService {
|
|||||||
readonly buffer: IBuffer;
|
readonly buffer: IBuffer;
|
||||||
readonly buffers: IBufferSet;
|
readonly buffers: IBufferSet;
|
||||||
isUserScrolling: boolean;
|
isUserScrolling: boolean;
|
||||||
onResize: IEvent<{ cols: number, rows: number }>;
|
onResize: Event<{ cols: number, rows: number }>;
|
||||||
onScroll: IEvent<number>;
|
onScroll: Event<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;
|
||||||
@@ -53,7 +52,7 @@ export interface ICoreMouseService {
|
|||||||
/**
|
/**
|
||||||
* Event to announce changes in mouse tracking.
|
* Event to announce changes in mouse tracking.
|
||||||
*/
|
*/
|
||||||
onProtocolChange: IEvent<CoreMouseEventType>;
|
onProtocolChange: Event<CoreMouseEventType>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Human readable version of mouse events.
|
* Human readable version of mouse events.
|
||||||
@@ -75,10 +74,10 @@ export interface ICoreService {
|
|||||||
readonly modes: IModes;
|
readonly modes: IModes;
|
||||||
readonly decPrivateModes: IDecPrivateModes;
|
readonly decPrivateModes: IDecPrivateModes;
|
||||||
|
|
||||||
readonly onData: IEvent<string>;
|
readonly onData: Event<string>;
|
||||||
readonly onUserInput: IEvent<void>;
|
readonly onUserInput: Event<void>;
|
||||||
readonly onBinary: IEvent<string>;
|
readonly onBinary: Event<string>;
|
||||||
readonly onRequestScrollToBottom: IEvent<void>;
|
readonly onRequestScrollToBottom: Event<void>;
|
||||||
|
|
||||||
reset(): void;
|
reset(): void;
|
||||||
|
|
||||||
@@ -187,7 +186,7 @@ export interface IOptionsService {
|
|||||||
/**
|
/**
|
||||||
* Adds an event listener for when any option changes.
|
* Adds an event listener for when any option changes.
|
||||||
*/
|
*/
|
||||||
readonly onOptionChange: IEvent<keyof ITerminalOptions>;
|
readonly onOptionChange: Event<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
|
||||||
@@ -339,7 +338,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: IEvent<string>;
|
readonly onChange: Event<string>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unicode version dependent
|
* Unicode version dependent
|
||||||
@@ -364,8 +363,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: IEvent<IInternalDecoration>;
|
readonly onDecorationRegistered: Event<IInternalDecoration>;
|
||||||
readonly onDecorationRemoved: IEvent<IInternalDecoration>;
|
readonly onDecorationRemoved: Event<IInternalDecoration>;
|
||||||
registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;
|
registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;
|
||||||
reset(): void;
|
reset(): void;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IEvent } from 'common/EventEmitter';
|
|
||||||
import { BufferNamespaceApi } from 'common/public/BufferNamespaceApi';
|
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';
|
||||||
@@ -12,6 +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 'vs/base/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,15 +72,15 @@ export class Terminal extends Disposable implements ITerminalApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public get onBell(): IEvent<void> { return this._core.onBell; }
|
public get onBell(): Event<void> { return this._core.onBell; }
|
||||||
public get onBinary(): IEvent<string> { return this._core.onBinary; }
|
public get onBinary(): Event<string> { return this._core.onBinary; }
|
||||||
public get onCursorMove(): IEvent<void> { return this._core.onCursorMove; }
|
public get onCursorMove(): Event<void> { return this._core.onCursorMove; }
|
||||||
public get onData(): IEvent<string> { return this._core.onData; }
|
public get onData(): Event<string> { return this._core.onData; }
|
||||||
public get onLineFeed(): IEvent<void> { return this._core.onLineFeed; }
|
public get onLineFeed(): Event<void> { return this._core.onLineFeed; }
|
||||||
public get onResize(): IEvent<{ cols: number, rows: number }> { return this._core.onResize; }
|
public get onResize(): Event<{ cols: number, rows: number }> { return this._core.onResize; }
|
||||||
public get onScroll(): IEvent<number> { return this._core.onScroll; }
|
public get onScroll(): Event<number> { return this._core.onScroll; }
|
||||||
public get onTitleChange(): IEvent<string> { return this._core.onTitleChange; }
|
public get onTitleChange(): Event<string> { return this._core.onTitleChange; }
|
||||||
public get onWriteParsed(): IEvent<void> { return this._core.onWriteParsed; }
|
public get onWriteParsed(): Event<void> { return this._core.onWriteParsed; }
|
||||||
|
|
||||||
public get parser(): IParser {
|
public get parser(): IParser {
|
||||||
this._checkProposedApi();
|
this._checkProposedApi();
|
||||||
|
|||||||
Reference in New Issue
Block a user