@xterm/xterm 5.6.0-beta.46 → 5.6.0-beta.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/lib/xterm.js +1 -1
  2. package/lib/xterm.js.map +1 -1
  3. package/lib/xterm.mjs +17 -17
  4. package/lib/xterm.mjs.map +4 -4
  5. package/package.json +3 -3
  6. package/src/browser/CoreBrowserTerminal.ts +24 -24
  7. package/src/browser/Linkifier.ts +3 -3
  8. package/src/browser/Types.ts +10 -10
  9. package/src/browser/Viewport.ts +4 -4
  10. package/src/browser/public/Terminal.ts +13 -13
  11. package/src/browser/renderer/dom/DomRenderer.ts +2 -2
  12. package/src/browser/renderer/shared/TextureAtlas.ts +3 -3
  13. package/src/browser/renderer/shared/Types.ts +4 -4
  14. package/src/browser/services/CharSizeService.ts +2 -2
  15. package/src/browser/services/CoreBrowserService.ts +5 -5
  16. package/src/browser/services/RenderService.ts +5 -5
  17. package/src/browser/services/SelectionService.ts +5 -5
  18. package/src/browser/services/Services.ts +13 -13
  19. package/src/browser/services/ThemeService.ts +2 -2
  20. package/src/common/CircularList.ts +4 -4
  21. package/src/common/CoreTerminal.ts +15 -15
  22. package/src/common/InputHandler.ts +20 -17
  23. package/src/common/Types.ts +9 -9
  24. package/src/common/buffer/Buffer.ts +4 -0
  25. package/src/common/buffer/BufferSet.ts +2 -2
  26. package/src/common/buffer/Marker.ts +2 -2
  27. package/src/common/buffer/Types.ts +2 -2
  28. package/src/common/input/WriteBuffer.ts +2 -2
  29. package/src/common/public/BufferNamespaceApi.ts +2 -2
  30. package/src/common/services/BufferService.ts +3 -3
  31. package/src/common/services/CoreMouseService.ts +2 -2
  32. package/src/common/services/CoreService.ts +5 -5
  33. package/src/common/services/DecorationService.ts +5 -5
  34. package/src/common/services/OptionsService.ts +2 -2
  35. package/src/common/services/Services.ts +13 -13
  36. package/src/common/services/UnicodeService.ts +2 -2
  37. package/src/vs/base/common/event.ts +16 -0
  38. package/src/common/EventEmitter.ts +0 -73
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xterm/xterm",
3
3
  "description": "Full xterm terminal, in your browser",
4
- "version": "5.6.0-beta.46",
4
+ "version": "5.6.0-beta.47",
5
5
  "main": "lib/xterm.js",
6
6
  "module": "lib/xterm.mjs",
7
7
  "style": "css/xterm.css",
@@ -52,8 +52,8 @@
52
52
  "test-integration-webkit": "node ./bin/test_integration.js --workers=75% \"--project=WebKit\"",
53
53
  "test-integration-debug": "node ./bin/test_integration.js --workers=1 --headed --timeout=30000",
54
54
  "benchmark": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json",
55
- "benchmark-baseline": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --baseline out-tsc/test-benchmark/test/benchmark/*benchmark.js",
56
- "benchmark-eval": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --eval out-tsc/test-benchmark/test/benchmark/*benchmark.js",
55
+ "benchmark-baseline": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --baseline out-test/benchmark/*benchmark.js",
56
+ "benchmark-eval": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --eval out-test/benchmark/*benchmark.js",
57
57
  "clean": "rm -rf lib out addons/*/lib addons/*/out",
58
58
  "vtfeatures": "node bin/extract_vtfeatures.js src/**/*.ts src/*.ts",
59
59
  "prepackage": "npm run build",
@@ -44,7 +44,6 @@ import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, ILinkPr
44
44
  import { ThemeService } from 'browser/services/ThemeService';
45
45
  import { channels, color } from 'common/Color';
46
46
  import { CoreTerminal } from 'common/CoreTerminal';
47
- import { EventEmitter, IEvent, forwardEvent } from 'common/EventEmitter';
48
47
  import { MutableDisposable, toDisposable } from 'common/Lifecycle';
49
48
  import * as Browser from 'common/Platform';
50
49
  import { ColorRequestType, CoreMouseAction, CoreMouseButton, CoreMouseEventType, IColorEvent, ITerminalOptions, KeyboardResultType, SpecialColorIndex } from 'common/Types';
@@ -58,6 +57,7 @@ import { IDecorationService } from 'common/services/Services';
58
57
  import { WindowsOptionsReportType } from '../common/InputHandler';
59
58
  import { AccessibilityManager } from './AccessibilityManager';
60
59
  import { Linkifier } from './Linkifier';
60
+ import { Emitter, Event } from 'vs/base/common/event';
61
61
 
62
62
  export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
63
63
  public textarea: HTMLTextAreaElement | undefined;
@@ -121,29 +121,29 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
121
121
  private _compositionHelper: ICompositionHelper | undefined;
122
122
  private _accessibilityManager: MutableDisposable<AccessibilityManager> = this.register(new MutableDisposable());
123
123
 
124
- private readonly _onCursorMove = this.register(new EventEmitter<void>());
124
+ private readonly _onCursorMove = this.register(new Emitter<void>());
125
125
  public readonly onCursorMove = this._onCursorMove.event;
126
- private readonly _onKey = this.register(new EventEmitter<{ key: string, domEvent: KeyboardEvent }>());
126
+ private readonly _onKey = this.register(new Emitter<{ key: string, domEvent: KeyboardEvent }>());
127
127
  public readonly onKey = this._onKey.event;
128
- private readonly _onRender = this.register(new EventEmitter<{ start: number, end: number }>());
128
+ private readonly _onRender = this.register(new Emitter<{ start: number, end: number }>());
129
129
  public readonly onRender = this._onRender.event;
130
- private readonly _onSelectionChange = this.register(new EventEmitter<void>());
130
+ private readonly _onSelectionChange = this.register(new Emitter<void>());
131
131
  public readonly onSelectionChange = this._onSelectionChange.event;
132
- private readonly _onTitleChange = this.register(new EventEmitter<string>());
132
+ private readonly _onTitleChange = this.register(new Emitter<string>());
133
133
  public readonly onTitleChange = this._onTitleChange.event;
134
- private readonly _onBell = this.register(new EventEmitter<void>());
134
+ private readonly _onBell = this.register(new Emitter<void>());
135
135
  public readonly onBell = this._onBell.event;
136
136
 
137
- private _onFocus = this.register(new EventEmitter<void>());
138
- public get onFocus(): IEvent<void> { return this._onFocus.event; }
139
- private _onBlur = this.register(new EventEmitter<void>());
140
- public get onBlur(): IEvent<void> { return this._onBlur.event; }
141
- private _onA11yCharEmitter = this.register(new EventEmitter<string>());
142
- public get onA11yChar(): IEvent<string> { return this._onA11yCharEmitter.event; }
143
- private _onA11yTabEmitter = this.register(new EventEmitter<number>());
144
- public get onA11yTab(): IEvent<number> { return this._onA11yTabEmitter.event; }
145
- private _onWillOpen = this.register(new EventEmitter<HTMLElement>());
146
- public get onWillOpen(): IEvent<HTMLElement> { return this._onWillOpen.event; }
137
+ private _onFocus = this.register(new Emitter<void>());
138
+ public get onFocus(): Event<void> { return this._onFocus.event; }
139
+ private _onBlur = this.register(new Emitter<void>());
140
+ public get onBlur(): Event<void> { return this._onBlur.event; }
141
+ private _onA11yCharEmitter = this.register(new Emitter<string>());
142
+ public get onA11yChar(): Event<string> { return this._onA11yCharEmitter.event; }
143
+ private _onA11yTabEmitter = this.register(new Emitter<number>());
144
+ public get onA11yTab(): Event<number> { return this._onA11yTabEmitter.event; }
145
+ private _onWillOpen = this.register(new Emitter<HTMLElement>());
146
+ public get onWillOpen(): Event<HTMLElement> { return this._onWillOpen.event; }
147
147
 
148
148
  constructor(
149
149
  options: Partial<ITerminalOptions> = {}
@@ -160,15 +160,15 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
160
160
 
161
161
  // Setup InputHandler listeners
162
162
  this.register(this._inputHandler.onRequestBell(() => this._onBell.fire()));
163
- this.register(this._inputHandler.onRequestRefreshRows((start, end) => this.refresh(start, end)));
163
+ this.register(this._inputHandler.onRequestRefreshRows((e) => this.refresh(e?.start ?? 0, e?.end ?? (this.rows - 1))));
164
164
  this.register(this._inputHandler.onRequestSendFocus(() => this._reportFocus()));
165
165
  this.register(this._inputHandler.onRequestReset(() => this.reset()));
166
166
  this.register(this._inputHandler.onRequestWindowsOptionsReport(type => this._reportWindowsOptions(type)));
167
167
  this.register(this._inputHandler.onColor((event) => this._handleColorEvent(event)));
168
- this.register(forwardEvent(this._inputHandler.onCursorMove, this._onCursorMove));
169
- this.register(forwardEvent(this._inputHandler.onTitleChange, this._onTitleChange));
170
- this.register(forwardEvent(this._inputHandler.onA11yChar, this._onA11yCharEmitter));
171
- this.register(forwardEvent(this._inputHandler.onA11yTab, this._onA11yTabEmitter));
168
+ this.register(Event.forward(this._inputHandler.onCursorMove, this._onCursorMove));
169
+ this.register(Event.forward(this._inputHandler.onTitleChange, this._onTitleChange));
170
+ this.register(Event.forward(this._inputHandler.onA11yChar, this._onA11yCharEmitter));
171
+ this.register(Event.forward(this._inputHandler.onA11yTab, this._onA11yTabEmitter));
172
172
 
173
173
  // Setup listeners
174
174
  this.register(this._bufferService.onResize(e => this._afterResize(e.cols, e.rows)));
@@ -672,7 +672,7 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
672
672
  * Note: 'mousedown' currently is "always on" and not managed
673
673
  * by onProtocolChange.
674
674
  */
675
- const requestedEvents: { [key: string]: ((ev: Event) => void) | null } = {
675
+ const requestedEvents: { [key: string]: ((ev: MouseEvent | WheelEvent) => void) | null } = {
676
676
  mouseup: null,
677
677
  wheel: null,
678
678
  mousedrag: null,
@@ -1292,7 +1292,7 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
1292
1292
  }
1293
1293
 
1294
1294
  // TODO: Remove cancel function and cancelEvents option
1295
- public cancel(ev: Event, force?: boolean): boolean | undefined {
1295
+ public cancel(ev: MouseEvent | WheelEvent | KeyboardEvent | InputEvent, force?: boolean): boolean | undefined {
1296
1296
  if (!this.options.cancelEvents && !force) {
1297
1297
  return;
1298
1298
  }
@@ -5,11 +5,11 @@
5
5
 
6
6
  import { addDisposableDomListener } from 'browser/Lifecycle';
7
7
  import { IBufferCellPosition, ILink, ILinkDecorations, ILinkWithState, ILinkifier2, ILinkifierEvent } from 'browser/Types';
8
- import { EventEmitter } from 'common/EventEmitter';
9
8
  import { Disposable, disposeArray, getDisposeArrayDisposable, toDisposable } from 'common/Lifecycle';
10
9
  import { IDisposable } from 'common/Types';
11
10
  import { IBufferService } from 'common/services/Services';
12
11
  import { ILinkProviderService, IMouseService, IRenderService } from './services/Services';
12
+ import { Emitter } from 'vs/base/common/event';
13
13
 
14
14
  export class Linkifier extends Disposable implements ILinkifier2 {
15
15
  public get currentLink(): ILinkWithState | undefined { return this._currentLink; }
@@ -23,9 +23,9 @@ export class Linkifier extends Disposable implements ILinkifier2 {
23
23
  private _activeProviderReplies: Map<Number, ILinkWithState[] | undefined> | undefined;
24
24
  private _activeLine: number = -1;
25
25
 
26
- private readonly _onShowLinkUnderline = this.register(new EventEmitter<ILinkifierEvent>());
26
+ private readonly _onShowLinkUnderline = this.register(new Emitter<ILinkifierEvent>());
27
27
  public readonly onShowLinkUnderline = this._onShowLinkUnderline.event;
28
- private readonly _onHideLinkUnderline = this.register(new EventEmitter<ILinkifierEvent>());
28
+ private readonly _onHideLinkUnderline = this.register(new Emitter<ILinkifierEvent>());
29
29
  public readonly onHideLinkUnderline = this._onHideLinkUnderline.event;
30
30
 
31
31
  constructor(
@@ -3,11 +3,11 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { IEvent } from 'common/EventEmitter';
7
6
  import { CharData, IColor, ICoreTerminal, ITerminalOptions } from 'common/Types';
8
7
  import { IBuffer } from 'common/buffer/Types';
9
8
  import { IDisposable, Terminal as ITerminalApi } from '@xterm/xterm';
10
9
  import { channels, css } from 'common/Color';
10
+ import type { Event } from 'vs/base/common/event';
11
11
 
12
12
  /**
13
13
  * 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 {
21
21
  linkifier: ILinkifier2 | undefined;
22
22
  options: Required<ITerminalOptions>;
23
23
 
24
- onBlur: IEvent<void>;
25
- onFocus: IEvent<void>;
26
- onA11yChar: IEvent<string>;
27
- onA11yTab: IEvent<number>;
28
- onWillOpen: IEvent<HTMLElement>;
24
+ onBlur: Event<void>;
25
+ onFocus: Event<void>;
26
+ onA11yChar: Event<string>;
27
+ onA11yTab: Event<number>;
28
+ onWillOpen: Event<HTMLElement>;
29
29
 
30
- cancel(ev: Event, force?: boolean): boolean | void;
30
+ cancel(ev: MouseEvent | WheelEvent | KeyboardEvent | InputEvent, force?: boolean): boolean | void;
31
31
  }
32
32
 
33
33
  export type CustomKeyEventHandler = (event: KeyboardEvent) => boolean;
@@ -98,7 +98,7 @@ export interface IPartialColorSet {
98
98
 
99
99
  export interface IViewport extends IDisposable {
100
100
  scrollBarWidth: number;
101
- readonly onRequestScrollLines: IEvent<{ amount: number, suppressScrollEvent: boolean }>;
101
+ readonly onRequestScrollLines: Event<{ amount: number, suppressScrollEvent: boolean }>;
102
102
  syncScrollArea(immediate?: boolean, force?: boolean): void;
103
103
  getLinesScrolled(ev: WheelEvent): number;
104
104
  getBufferElements(startLine: number, endLine?: number): { bufferElements: HTMLElement[], cursorElement?: HTMLElement };
@@ -128,8 +128,8 @@ export interface ILinkWithState {
128
128
  }
129
129
 
130
130
  export interface ILinkifier2 extends IDisposable {
131
- onShowLinkUnderline: IEvent<ILinkifierEvent>;
132
- onHideLinkUnderline: IEvent<ILinkifierEvent>;
131
+ onShowLinkUnderline: Event<ILinkifierEvent>;
132
+ onHideLinkUnderline: Event<ILinkifierEvent>;
133
133
  readonly currentLink: ILinkWithState | undefined;
134
134
  }
135
135
 
@@ -5,18 +5,18 @@
5
5
 
6
6
  import { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
7
7
  import { ViewportConstants } from 'browser/shared/Constants';
8
- import { EventEmitter, runAndSubscribe } from 'common/EventEmitter';
9
8
  import { Disposable, toDisposable } from 'common/Lifecycle';
10
9
  import { IBufferService, ICoreMouseService, IOptionsService } from 'common/services/Services';
11
10
  import { CoreMouseEventType } from 'common/Types';
12
11
  import { scheduleAtNextAnimationFrame } from 'vs/base/browser/dom';
13
12
  import { SmoothScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
14
13
  import type { ScrollableElementChangeOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';
14
+ import { Emitter, Event } from 'vs/base/common/event';
15
15
  import { Scrollable, ScrollbarVisibility, type ScrollEvent } from 'vs/base/common/scrollable';
16
16
 
17
17
  export class Viewport extends Disposable {
18
18
 
19
- protected _onRequestScrollLines = this.register(new EventEmitter<number>());
19
+ protected _onRequestScrollLines = this.register(new Emitter<number>());
20
20
  public readonly onRequestScrollLines = this._onRequestScrollLines.event;
21
21
 
22
22
  private _scrollableElement: SmoothScrollableElement;
@@ -70,7 +70,7 @@ export class Viewport extends Disposable {
70
70
  }));
71
71
 
72
72
  this._scrollableElement.setScrollDimensions({ height: 0, scrollHeight: 0 });
73
- this.register(runAndSubscribe(themeService.onChangeColors, () => {
73
+ this.register(Event.runAndSubscribe(themeService.onChangeColors, () => {
74
74
  this._scrollableElement.getDomNode().style.backgroundColor = themeService.colors.background.css;
75
75
  }));
76
76
  element.appendChild(this._scrollableElement.getDomNode());
@@ -79,7 +79,7 @@ export class Viewport extends Disposable {
79
79
  this._styleElement = coreBrowserService.window.document.createElement('style');
80
80
  screenElement.appendChild(this._styleElement);
81
81
  this.register(toDisposable(() => this._styleElement.remove()));
82
- this.register(runAndSubscribe(themeService.onChangeColors, () => {
82
+ this.register(Event.runAndSubscribe(themeService.onChangeColors, () => {
83
83
  this._styleElement.textContent = [
84
84
  `.xterm .xterm-scrollable-element > .scrollbar > .slider {`,
85
85
  ` background: ${themeService.colors.scrollbarSliderBackground.css};`,
@@ -6,7 +6,6 @@
6
6
  import * as Strings from 'browser/LocalizableStrings';
7
7
  import { CoreBrowserTerminal as TerminalCore } from 'browser/CoreBrowserTerminal';
8
8
  import { IBufferRange, ITerminal } from 'browser/Types';
9
- import { IEvent } from 'common/EventEmitter';
10
9
  import { Disposable } from 'common/Lifecycle';
11
10
  import { ITerminalOptions } from 'common/Types';
12
11
  import { AddonManager } from 'common/public/AddonManager';
@@ -14,6 +13,7 @@ import { BufferNamespaceApi } from 'common/public/BufferNamespaceApi';
14
13
  import { ParserApi } from 'common/public/ParserApi';
15
14
  import { UnicodeApi } from 'common/public/UnicodeApi';
16
15
  import { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from '@xterm/xterm';
16
+ import type { Event } from 'vs/base/common/event';
17
17
 
18
18
  /**
19
19
  * 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 {
68
68
  }
69
69
  }
70
70
 
71
- public get onBell(): IEvent<void> { return this._core.onBell; }
72
- public get onBinary(): IEvent<string> { return this._core.onBinary; }
73
- public get onCursorMove(): IEvent<void> { return this._core.onCursorMove; }
74
- public get onData(): IEvent<string> { return this._core.onData; }
75
- public get onKey(): IEvent<{ key: string, domEvent: KeyboardEvent }> { return this._core.onKey; }
76
- public get onLineFeed(): IEvent<void> { return this._core.onLineFeed; }
77
- public get onRender(): IEvent<{ start: number, end: number }> { return this._core.onRender; }
78
- public get onResize(): IEvent<{ cols: number, rows: number }> { return this._core.onResize; }
79
- public get onScroll(): IEvent<number> { return this._core.onScroll; }
80
- public get onSelectionChange(): IEvent<void> { return this._core.onSelectionChange; }
81
- public get onTitleChange(): IEvent<string> { return this._core.onTitleChange; }
82
- public get onWriteParsed(): IEvent<void> { return this._core.onWriteParsed; }
71
+ public get onBell(): Event<void> { return this._core.onBell; }
72
+ public get onBinary(): Event<string> { return this._core.onBinary; }
73
+ public get onCursorMove(): Event<void> { return this._core.onCursorMove; }
74
+ public get onData(): Event<string> { return this._core.onData; }
75
+ public get onKey(): Event<{ key: string, domEvent: KeyboardEvent }> { return this._core.onKey; }
76
+ public get onLineFeed(): Event<void> { return this._core.onLineFeed; }
77
+ public get onRender(): Event<{ start: number, end: number }> { return this._core.onRender; }
78
+ public get onResize(): Event<{ cols: number, rows: number }> { return this._core.onResize; }
79
+ public get onScroll(): Event<number> { return this._core.onScroll; }
80
+ public get onSelectionChange(): Event<void> { return this._core.onSelectionChange; }
81
+ public get onTitleChange(): Event<string> { return this._core.onTitleChange; }
82
+ public get onWriteParsed(): Event<void> { return this._core.onWriteParsed; }
83
83
 
84
84
  public get element(): HTMLElement | undefined { return this._core.element; }
85
85
  public get parser(): IParser {
@@ -12,9 +12,9 @@ import { IRenderDimensions, IRenderer, IRequestRedrawEvent, ISelectionRenderMode
12
12
  import { ICharSizeService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
13
13
  import { ILinkifier2, ILinkifierEvent, ITerminal, ReadonlyColorSet } from 'browser/Types';
14
14
  import { color } from 'common/Color';
15
- import { EventEmitter } from 'common/EventEmitter';
16
15
  import { Disposable, toDisposable } from 'common/Lifecycle';
17
16
  import { IBufferService, IInstantiationService, IOptionsService } from 'common/services/Services';
17
+ import { Emitter } from 'vs/base/common/event';
18
18
 
19
19
 
20
20
  const TERMINAL_CLASS_PREFIX = 'xterm-dom-renderer-owner-';
@@ -45,7 +45,7 @@ export class DomRenderer extends Disposable implements IRenderer {
45
45
 
46
46
  public dimensions: IRenderDimensions;
47
47
 
48
- public readonly onRequestRedraw = this.register(new EventEmitter<IRequestRedrawEvent>()).event;
48
+ public readonly onRequestRedraw = this.register(new Emitter<IRequestRedrawEvent>()).event;
49
49
 
50
50
  constructor(
51
51
  private readonly _terminal: ITerminal,
@@ -9,13 +9,13 @@ import { tryDrawCustomChar } from 'browser/renderer/shared/CustomGlyphs';
9
9
  import { computeNextVariantOffset, treatGlyphAsBackgroundColor, isPowerlineGlyph, isRestrictedPowerlineGlyph, throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
10
10
  import { IBoundingBox, ICharAtlasConfig, IRasterizedGlyph, ITextureAtlas } from 'browser/renderer/shared/Types';
11
11
  import { NULL_COLOR, channels, color, rgba } from 'common/Color';
12
- import { EventEmitter } from 'common/EventEmitter';
13
12
  import { FourKeyMap } from 'common/MultiKeyMap';
14
13
  import { IdleTaskQueue } from 'common/TaskQueue';
15
14
  import { IColor } from 'common/Types';
16
15
  import { AttributeData } from 'common/buffer/AttributeData';
17
16
  import { Attributes, DEFAULT_COLOR, DEFAULT_EXT, UnderlineStyle } from 'common/buffer/Constants';
18
17
  import { IUnicodeService } from 'common/services/Services';
18
+ import { Emitter } from 'vs/base/common/event';
19
19
 
20
20
  /**
21
21
  * A shared object which is used to draw nothing for a particular cell.
@@ -79,9 +79,9 @@ export class TextureAtlas implements ITextureAtlas {
79
79
  public static maxAtlasPages: number | undefined;
80
80
  public static maxTextureSize: number | undefined;
81
81
 
82
- private readonly _onAddTextureAtlasCanvas = new EventEmitter<HTMLCanvasElement>();
82
+ private readonly _onAddTextureAtlasCanvas = new Emitter<HTMLCanvasElement>();
83
83
  public readonly onAddTextureAtlasCanvas = this._onAddTextureAtlasCanvas.event;
84
- private readonly _onRemoveTextureAtlasCanvas = new EventEmitter<HTMLCanvasElement>();
84
+ private readonly _onRemoveTextureAtlasCanvas = new Emitter<HTMLCanvasElement>();
85
85
  public readonly onRemoveTextureAtlasCanvas = this._onRemoveTextureAtlasCanvas.event;
86
86
 
87
87
  constructor(
@@ -6,7 +6,7 @@
6
6
  import { FontWeight, Terminal } from '@xterm/xterm';
7
7
  import { IColorSet, ITerminal } from 'browser/Types';
8
8
  import { IDisposable } from 'common/Types';
9
- import { IEvent } from 'common/EventEmitter';
9
+ import type { Event } from 'vs/base/common/event';
10
10
 
11
11
  export interface ICharAtlasConfig {
12
12
  customGlyphs: boolean;
@@ -71,7 +71,7 @@ export interface IRenderer extends IDisposable {
71
71
  * Fires when the renderer is requesting to be redrawn on the next animation
72
72
  * frame but is _not_ a result of content changing (eg. selection changes).
73
73
  */
74
- readonly onRequestRedraw: IEvent<IRequestRedrawEvent>;
74
+ readonly onRequestRedraw: Event<IRequestRedrawEvent>;
75
75
 
76
76
  dispose(): void;
77
77
  handleDevicePixelRatioChange(): void;
@@ -89,8 +89,8 @@ export interface IRenderer extends IDisposable {
89
89
  export interface ITextureAtlas extends IDisposable {
90
90
  readonly pages: { canvas: HTMLCanvasElement, version: number }[];
91
91
 
92
- onAddTextureAtlasCanvas: IEvent<HTMLCanvasElement>;
93
- onRemoveTextureAtlasCanvas: IEvent<HTMLCanvasElement>;
92
+ onAddTextureAtlasCanvas: Event<HTMLCanvasElement>;
93
+ onRemoveTextureAtlasCanvas: Event<HTMLCanvasElement>;
94
94
 
95
95
  /**
96
96
  * Warm up the texture atlas, adding common glyphs to avoid slowing early frame.
@@ -4,9 +4,9 @@
4
4
  */
5
5
 
6
6
  import { IOptionsService } from 'common/services/Services';
7
- import { EventEmitter } from 'common/EventEmitter';
8
7
  import { ICharSizeService } from 'browser/services/Services';
9
8
  import { Disposable } from 'common/Lifecycle';
9
+ import { Emitter } from 'vs/base/common/event';
10
10
 
11
11
  export class CharSizeService extends Disposable implements ICharSizeService {
12
12
  public serviceBrand: undefined;
@@ -17,7 +17,7 @@ export class CharSizeService extends Disposable implements ICharSizeService {
17
17
 
18
18
  public get hasValidSize(): boolean { return this.width > 0 && this.height > 0; }
19
19
 
20
- private readonly _onCharSizeChange = this.register(new EventEmitter<void>());
20
+ private readonly _onCharSizeChange = this.register(new Emitter<void>());
21
21
  public readonly onCharSizeChange = this._onCharSizeChange.event;
22
22
 
23
23
  constructor(
@@ -5,8 +5,8 @@
5
5
 
6
6
  import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
7
7
  import { ICoreBrowserService } from './Services';
8
- import { EventEmitter, forwardEvent } from 'common/EventEmitter';
9
8
  import { addDisposableDomListener } from 'browser/Lifecycle';
9
+ import { Emitter, Event } from 'vs/base/common/event';
10
10
 
11
11
  export class CoreBrowserService extends Disposable implements ICoreBrowserService {
12
12
  public serviceBrand: undefined;
@@ -15,9 +15,9 @@ export class CoreBrowserService extends Disposable implements ICoreBrowserServic
15
15
  private _cachedIsFocused: boolean | undefined = undefined;
16
16
  private _screenDprMonitor = this.register(new ScreenDprMonitor(this._window));
17
17
 
18
- private readonly _onDprChange = this.register(new EventEmitter<number>());
18
+ private readonly _onDprChange = this.register(new Emitter<number>());
19
19
  public readonly onDprChange = this._onDprChange.event;
20
- private readonly _onWindowChange = this.register(new EventEmitter<Window & typeof globalThis>());
20
+ private readonly _onWindowChange = this.register(new Emitter<Window & typeof globalThis>());
21
21
  public readonly onWindowChange = this._onWindowChange.event;
22
22
 
23
23
  constructor(
@@ -29,7 +29,7 @@ export class CoreBrowserService extends Disposable implements ICoreBrowserServic
29
29
 
30
30
  // Monitor device pixel ratio
31
31
  this.register(this.onWindowChange(w => this._screenDprMonitor.setWindow(w)));
32
- this.register(forwardEvent(this._screenDprMonitor.onDprChange, this._onDprChange));
32
+ this.register(Event.forward(this._screenDprMonitor.onDprChange, this._onDprChange));
33
33
 
34
34
  this.register(
35
35
  addDisposableDomListener(this._textarea, 'focus', () => (this._isFocused = true))
@@ -80,7 +80,7 @@ class ScreenDprMonitor extends Disposable {
80
80
  private _resolutionMediaMatchList: MediaQueryList | undefined;
81
81
  private _windowResizeListener = this.register(new MutableDisposable());
82
82
 
83
- private readonly _onDprChange = this.register(new EventEmitter<number>());
83
+ private readonly _onDprChange = this.register(new Emitter<number>());
84
84
  public readonly onDprChange = this._onDprChange.event;
85
85
 
86
86
  constructor(private _parentWindow: Window) {
@@ -7,10 +7,10 @@ import { RenderDebouncer } from 'browser/RenderDebouncer';
7
7
  import { IRenderDebouncerWithCallback } from 'browser/Types';
8
8
  import { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';
9
9
  import { ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
10
- import { EventEmitter } from 'common/EventEmitter';
11
10
  import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
12
11
  import { DebouncedIdleTask } from 'common/TaskQueue';
13
12
  import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';
13
+ import { Emitter } from 'vs/base/common/event';
14
14
 
15
15
  interface ISelectionState {
16
16
  start: [number, number] | undefined;
@@ -38,13 +38,13 @@ export class RenderService extends Disposable implements IRenderService {
38
38
  columnSelectMode: false
39
39
  };
40
40
 
41
- private readonly _onDimensionsChange = this.register(new EventEmitter<IRenderDimensions>());
41
+ private readonly _onDimensionsChange = this.register(new Emitter<IRenderDimensions>());
42
42
  public readonly onDimensionsChange = this._onDimensionsChange.event;
43
- private readonly _onRenderedViewportChange = this.register(new EventEmitter<{ start: number, end: number }>());
43
+ private readonly _onRenderedViewportChange = this.register(new Emitter<{ start: number, end: number }>());
44
44
  public readonly onRenderedViewportChange = this._onRenderedViewportChange.event;
45
- private readonly _onRender = this.register(new EventEmitter<{ start: number, end: number }>());
45
+ private readonly _onRender = this.register(new Emitter<{ start: number, end: number }>());
46
46
  public readonly onRender = this._onRender.event;
47
- private readonly _onRefreshRequest = this.register(new EventEmitter<{ start: number, end: number }>());
47
+ private readonly _onRefreshRequest = this.register(new Emitter<{ start: number, end: number }>());
48
48
  public readonly onRefreshRequest = this._onRefreshRequest.event;
49
49
 
50
50
  public get dimensions(): IRenderDimensions { return this._renderer.value!.dimensions; }
@@ -9,7 +9,6 @@ import { moveToCellSequence } from 'browser/input/MoveToCell';
9
9
  import { SelectionModel } from 'browser/selection/SelectionModel';
10
10
  import { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';
11
11
  import { ICoreBrowserService, IMouseService, IRenderService, ISelectionService } from 'browser/services/Services';
12
- import { EventEmitter } from 'common/EventEmitter';
13
12
  import { Disposable, toDisposable } from 'common/Lifecycle';
14
13
  import * as Browser from 'common/Platform';
15
14
  import { IBufferLine, IDisposable } from 'common/Types';
@@ -17,6 +16,7 @@ import { getRangeLength } from 'common/buffer/BufferRange';
17
16
  import { CellData } from 'common/buffer/CellData';
18
17
  import { IBuffer } from 'common/buffer/Types';
19
18
  import { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';
19
+ import { Emitter } from 'vs/base/common/event';
20
20
 
21
21
  /**
22
22
  * The number of pixels the mouse needs to be above or below the viewport in
@@ -111,13 +111,13 @@ export class SelectionService extends Disposable implements ISelectionService {
111
111
  private _oldSelectionStart: [number, number] | undefined = undefined;
112
112
  private _oldSelectionEnd: [number, number] | undefined = undefined;
113
113
 
114
- private readonly _onLinuxMouseSelection = this.register(new EventEmitter<string>());
114
+ private readonly _onLinuxMouseSelection = this.register(new Emitter<string>());
115
115
  public readonly onLinuxMouseSelection = this._onLinuxMouseSelection.event;
116
- private readonly _onRedrawRequest = this.register(new EventEmitter<ISelectionRedrawRequestEvent>());
116
+ private readonly _onRedrawRequest = this.register(new Emitter<ISelectionRedrawRequestEvent>());
117
117
  public readonly onRequestRedraw = this._onRedrawRequest.event;
118
- private readonly _onSelectionChange = this.register(new EventEmitter<void>());
118
+ private readonly _onSelectionChange = this.register(new Emitter<void>());
119
119
  public readonly onSelectionChange = this._onSelectionChange.event;
120
- private readonly _onRequestScrollLines = this.register(new EventEmitter<ISelectionRequestScrollLinesEvent>());
120
+ private readonly _onRequestScrollLines = this.register(new Emitter<ISelectionRequestScrollLinesEvent>());
121
121
  public readonly onRequestScrollLines = this._onRequestScrollLines.event;
122
122
 
123
123
  constructor(
@@ -3,12 +3,12 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { IEvent } from 'common/EventEmitter';
7
6
  import { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';
8
7
  import { IColorSet, ILink, ReadonlyColorSet } from 'browser/Types';
9
8
  import { ISelectionRedrawRequestEvent as ISelectionRequestRedrawEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';
10
9
  import { createDecorator } from 'common/services/ServiceRegistry';
11
10
  import { AllColorIndex, IDisposable } from 'common/Types';
11
+ import type { Event } from 'vs/base/common/event';
12
12
 
13
13
  export const ICharSizeService = createDecorator<ICharSizeService>('CharSizeService');
14
14
  export interface ICharSizeService {
@@ -18,7 +18,7 @@ export interface ICharSizeService {
18
18
  readonly height: number;
19
19
  readonly hasValidSize: boolean;
20
20
 
21
- readonly onCharSizeChange: IEvent<void>;
21
+ readonly onCharSizeChange: Event<void>;
22
22
 
23
23
  measure(): void;
24
24
  }
@@ -29,8 +29,8 @@ export interface ICoreBrowserService {
29
29
 
30
30
  readonly isFocused: boolean;
31
31
 
32
- readonly onDprChange: IEvent<number>;
33
- readonly onWindowChange: IEvent<Window & typeof globalThis>;
32
+ readonly onDprChange: Event<number>;
33
+ readonly onWindowChange: Event<Window & typeof globalThis>;
34
34
 
35
35
  /**
36
36
  * 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');
61
61
  export interface IRenderService extends IDisposable {
62
62
  serviceBrand: undefined;
63
63
 
64
- onDimensionsChange: IEvent<IRenderDimensions>;
64
+ onDimensionsChange: Event<IRenderDimensions>;
65
65
  /**
66
66
  * Fires when buffer changes are rendered. This does not fire when only cursor
67
67
  * or selections are rendered.
68
68
  */
69
- onRenderedViewportChange: IEvent<{ start: number, end: number }>;
69
+ onRenderedViewportChange: Event<{ start: number, end: number }>;
70
70
  /**
71
71
  * Fires on render
72
72
  */
73
- onRender: IEvent<{ start: number, end: number }>;
74
- onRefreshRequest: IEvent<{ start: number, end: number }>;
73
+ onRender: Event<{ start: number, end: number }>;
74
+ onRefreshRequest: Event<{ start: number, end: number }>;
75
75
 
76
76
  dimensions: IRenderDimensions;
77
77
 
@@ -101,10 +101,10 @@ export interface ISelectionService {
101
101
  readonly selectionStart: [number, number] | undefined;
102
102
  readonly selectionEnd: [number, number] | undefined;
103
103
 
104
- readonly onLinuxMouseSelection: IEvent<string>;
105
- readonly onRequestRedraw: IEvent<ISelectionRequestRedrawEvent>;
106
- readonly onRequestScrollLines: IEvent<ISelectionRequestScrollLinesEvent>;
107
- readonly onSelectionChange: IEvent<void>;
104
+ readonly onLinuxMouseSelection: Event<string>;
105
+ readonly onRequestRedraw: Event<ISelectionRequestRedrawEvent>;
106
+ readonly onRequestScrollLines: Event<ISelectionRequestScrollLinesEvent>;
107
+ readonly onSelectionChange: Event<void>;
108
108
 
109
109
  disable(): void;
110
110
  enable(): void;
@@ -136,7 +136,7 @@ export interface IThemeService {
136
136
 
137
137
  readonly colors: ReadonlyColorSet;
138
138
 
139
- readonly onChangeColors: IEvent<ReadonlyColorSet>;
139
+ readonly onChangeColors: Event<ReadonlyColorSet>;
140
140
 
141
141
  restoreColor(slot?: AllColorIndex): void;
142
142
  /**
@@ -7,10 +7,10 @@ import { ColorContrastCache } from 'browser/ColorContrastCache';
7
7
  import { IThemeService } from 'browser/services/Services';
8
8
  import { DEFAULT_ANSI_COLORS, IColorContrastCache, IColorSet, ReadonlyColorSet } from 'browser/Types';
9
9
  import { color, css, NULL_COLOR } from 'common/Color';
10
- import { EventEmitter } from 'common/EventEmitter';
11
10
  import { Disposable } from 'common/Lifecycle';
12
11
  import { IOptionsService, ITheme } from 'common/services/Services';
13
12
  import { AllColorIndex, IColor, SpecialColorIndex } from 'common/Types';
13
+ import { Emitter } from 'vs/base/common/event';
14
14
 
15
15
  interface IRestoreColorSet {
16
16
  foreground: IColor;
@@ -40,7 +40,7 @@ export class ThemeService extends Disposable implements IThemeService {
40
40
 
41
41
  public get colors(): ReadonlyColorSet { return this._colors; }
42
42
 
43
- private readonly _onChangeColors = this.register(new EventEmitter<ReadonlyColorSet>());
43
+ private readonly _onChangeColors = this.register(new Emitter<ReadonlyColorSet>());
44
44
  public readonly onChangeColors = this._onChangeColors.event;
45
45
 
46
46
  constructor(
@@ -4,8 +4,8 @@
4
4
  */
5
5
 
6
6
  import { ICircularList } from 'common/Types';
7
- import { EventEmitter } from 'common/EventEmitter';
8
7
  import { Disposable } from 'common/Lifecycle';
8
+ import { Emitter } from 'vs/base/common/event';
9
9
 
10
10
  export interface IInsertEvent {
11
11
  index: number;
@@ -26,11 +26,11 @@ export class CircularList<T> extends Disposable implements ICircularList<T> {
26
26
  private _startIndex: number;
27
27
  private _length: number;
28
28
 
29
- public readonly onDeleteEmitter = this.register(new EventEmitter<IDeleteEvent>());
29
+ public readonly onDeleteEmitter = this.register(new Emitter<IDeleteEvent>());
30
30
  public readonly onDelete = this.onDeleteEmitter.event;
31
- public readonly onInsertEmitter = this.register(new EventEmitter<IInsertEvent>());
31
+ public readonly onInsertEmitter = this.register(new Emitter<IInsertEvent>());
32
32
  public readonly onInsert = this.onInsertEmitter.event;
33
- public readonly onTrimEmitter = this.register(new EventEmitter<number>());
33
+ public readonly onTrimEmitter = this.register(new Emitter<number>());
34
34
  public readonly onTrim = this.onTrimEmitter.event;
35
35
 
36
36
  constructor(