@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
@@ -29,7 +29,6 @@ import { BufferService, MINIMUM_COLS, MINIMUM_ROWS } from 'common/services/Buffe
29
29
  import { OptionsService } from 'common/services/OptionsService';
30
30
  import { IDisposable, IAttributeData, ICoreTerminal, IScrollEvent } from 'common/Types';
31
31
  import { CoreService } from 'common/services/CoreService';
32
- import { EventEmitter, IEvent, forwardEvent } from 'common/EventEmitter';
33
32
  import { CoreMouseService } from 'common/services/CoreMouseService';
34
33
  import { UnicodeService } from 'common/services/UnicodeService';
35
34
  import { CharsetService } from 'common/services/CharsetService';
@@ -39,6 +38,7 @@ import { IBufferSet } from 'common/buffer/Types';
39
38
  import { InputHandler } from 'common/InputHandler';
40
39
  import { WriteBuffer } from 'common/input/WriteBuffer';
41
40
  import { OscLinkService } from 'common/services/OscLinkService';
41
+ import { Emitter, Event } from 'vs/base/common/event';
42
42
 
43
43
  // Only trigger this warning a single time per session
44
44
  let hasWriteSyncWarnHappened = false;
@@ -59,26 +59,26 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
59
59
  private _writeBuffer: WriteBuffer;
60
60
  private _windowsWrappingHeuristics = this.register(new MutableDisposable());
61
61
 
62
- private readonly _onBinary = this.register(new EventEmitter<string>());
62
+ private readonly _onBinary = this.register(new Emitter<string>());
63
63
  public readonly onBinary = this._onBinary.event;
64
- private readonly _onData = this.register(new EventEmitter<string>());
64
+ private readonly _onData = this.register(new Emitter<string>());
65
65
  public readonly onData = this._onData.event;
66
- protected _onLineFeed = this.register(new EventEmitter<void>());
66
+ protected _onLineFeed = this.register(new Emitter<void>());
67
67
  public readonly onLineFeed = this._onLineFeed.event;
68
- private readonly _onResize = this.register(new EventEmitter<{ cols: number, rows: number }>());
68
+ private readonly _onResize = this.register(new Emitter<{ cols: number, rows: number }>());
69
69
  public readonly onResize = this._onResize.event;
70
- protected readonly _onWriteParsed = this.register(new EventEmitter<void>());
70
+ protected readonly _onWriteParsed = this.register(new Emitter<void>());
71
71
  public readonly onWriteParsed = this._onWriteParsed.event;
72
72
 
73
73
  /**
74
74
  * Internally we track the source of the scroll but this is meaningless outside the library so
75
75
  * it's filtered out.
76
76
  */
77
- protected _onScrollApi?: EventEmitter<number, void>;
78
- protected _onScroll = this.register(new EventEmitter<IScrollEvent, void>());
79
- public get onScroll(): IEvent<number, void> {
77
+ protected _onScrollApi?: Emitter<number>;
78
+ protected _onScroll = this.register(new Emitter<IScrollEvent>());
79
+ public get onScroll(): Event<number> {
80
80
  if (!this._onScrollApi) {
81
- this._onScrollApi = this.register(new EventEmitter<number, void>());
81
+ this._onScrollApi = this.register(new Emitter<number>());
82
82
  this._onScroll.event(ev => {
83
83
  this._onScrollApi?.fire(ev.position);
84
84
  });
@@ -123,13 +123,13 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
123
123
 
124
124
  // Register input handler and handle/forward events
125
125
  this._inputHandler = this.register(new InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService));
126
- this.register(forwardEvent(this._inputHandler.onLineFeed, this._onLineFeed));
126
+ this.register(Event.forward(this._inputHandler.onLineFeed, this._onLineFeed));
127
127
  this.register(this._inputHandler);
128
128
 
129
129
  // Setup listeners
130
- this.register(forwardEvent(this._bufferService.onResize, this._onResize));
131
- this.register(forwardEvent(this.coreService.onData, this._onData));
132
- this.register(forwardEvent(this.coreService.onBinary, this._onBinary));
130
+ this.register(Event.forward(this._bufferService.onResize, this._onResize));
131
+ this.register(Event.forward(this.coreService.onData, this._onData));
132
+ this.register(Event.forward(this.coreService.onBinary, this._onBinary));
133
133
  this.register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom(true)));
134
134
  this.register(this.coreService.onUserInput(() => this._writeBuffer.handleUserInput()));
135
135
  this.register(this.optionsService.onMultipleOptionChange(['windowsMode', 'windowsPty'], () => this._handleWindowsPtyOptionChange()));
@@ -139,7 +139,7 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
139
139
  }));
140
140
  // Setup WriteBuffer
141
141
  this._writeBuffer = this.register(new WriteBuffer((data, promiseResult) => this._inputHandler.parse(data, promiseResult)));
142
- this.register(forwardEvent(this._writeBuffer.onWriteParsed, this._onWriteParsed));
142
+ this.register(Event.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));
143
143
  }
144
144
 
145
145
  public write(data: string | Uint8Array, callback?: () => void): void {
@@ -11,7 +11,6 @@ import { EscapeSequenceParser } from 'common/parser/EscapeSequenceParser';
11
11
  import { Disposable } from 'common/Lifecycle';
12
12
  import { StringToUtf32, stringFromCodePoint, Utf8ToUtf32 } from 'common/input/TextDecoder';
13
13
  import { BufferLine, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';
14
- import { EventEmitter } from 'common/EventEmitter';
15
14
  import { IParsingState, IEscapeSequenceParser, IParams, IFunctionIdentifier } from 'common/parser/Types';
16
15
  import { NULL_CELL_CODE, NULL_CELL_WIDTH, Attributes, FgFlags, BgFlags, Content, UnderlineStyle } from 'common/buffer/Constants';
17
16
  import { CellData } from 'common/buffer/CellData';
@@ -22,6 +21,7 @@ import { OscHandler } from 'common/parser/OscParser';
22
21
  import { DcsHandler } from 'common/parser/DcsParser';
23
22
  import { IBuffer } from 'common/buffer/Types';
24
23
  import { parseColor } from 'common/input/XParseColor';
24
+ import { Emitter } from 'vs/base/common/event';
25
25
 
26
26
  /**
27
27
  * Map collect to glevel. Used in `selectCharset`.
@@ -132,32 +132,32 @@ export class InputHandler extends Disposable implements IInputHandler {
132
132
 
133
133
  private _activeBuffer: IBuffer;
134
134
 
135
- private readonly _onRequestBell = this.register(new EventEmitter<void>());
135
+ private readonly _onRequestBell = this.register(new Emitter<void>());
136
136
  public readonly onRequestBell = this._onRequestBell.event;
137
- private readonly _onRequestRefreshRows = this.register(new EventEmitter<number, number>());
137
+ private readonly _onRequestRefreshRows = this.register(new Emitter<{ start: number, end: number } | undefined>());
138
138
  public readonly onRequestRefreshRows = this._onRequestRefreshRows.event;
139
- private readonly _onRequestReset = this.register(new EventEmitter<void>());
139
+ private readonly _onRequestReset = this.register(new Emitter<void>());
140
140
  public readonly onRequestReset = this._onRequestReset.event;
141
- private readonly _onRequestSendFocus = this.register(new EventEmitter<void>());
141
+ private readonly _onRequestSendFocus = this.register(new Emitter<void>());
142
142
  public readonly onRequestSendFocus = this._onRequestSendFocus.event;
143
- private readonly _onRequestSyncScrollBar = this.register(new EventEmitter<void>());
143
+ private readonly _onRequestSyncScrollBar = this.register(new Emitter<void>());
144
144
  public readonly onRequestSyncScrollBar = this._onRequestSyncScrollBar.event;
145
- private readonly _onRequestWindowsOptionsReport = this.register(new EventEmitter<WindowsOptionsReportType>());
145
+ private readonly _onRequestWindowsOptionsReport = this.register(new Emitter<WindowsOptionsReportType>());
146
146
  public readonly onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event;
147
147
 
148
- private readonly _onA11yChar = this.register(new EventEmitter<string>());
148
+ private readonly _onA11yChar = this.register(new Emitter<string>());
149
149
  public readonly onA11yChar = this._onA11yChar.event;
150
- private readonly _onA11yTab = this.register(new EventEmitter<number>());
150
+ private readonly _onA11yTab = this.register(new Emitter<number>());
151
151
  public readonly onA11yTab = this._onA11yTab.event;
152
- private readonly _onCursorMove = this.register(new EventEmitter<void>());
152
+ private readonly _onCursorMove = this.register(new Emitter<void>());
153
153
  public readonly onCursorMove = this._onCursorMove.event;
154
- private readonly _onLineFeed = this.register(new EventEmitter<void>());
154
+ private readonly _onLineFeed = this.register(new Emitter<void>());
155
155
  public readonly onLineFeed = this._onLineFeed.event;
156
- private readonly _onScroll = this.register(new EventEmitter<number>());
156
+ private readonly _onScroll = this.register(new Emitter<number>());
157
157
  public readonly onScroll = this._onScroll.event;
158
- private readonly _onTitleChange = this.register(new EventEmitter<string>());
158
+ private readonly _onTitleChange = this.register(new Emitter<string>());
159
159
  public readonly onTitleChange = this._onTitleChange.event;
160
- private readonly _onColor = this.register(new EventEmitter<IColorEvent>());
160
+ private readonly _onColor = this.register(new Emitter<IColorEvent>());
161
161
  public readonly onColor = this._onColor.event;
162
162
 
163
163
  private _parseStack: IParseStack = {
@@ -500,7 +500,10 @@ export class InputHandler extends Disposable implements IInputHandler {
500
500
  const viewportEnd = this._dirtyRowTracker.end + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);
501
501
  const viewportStart = this._dirtyRowTracker.start + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);
502
502
  if (viewportStart < this._bufferService.rows) {
503
- this._onRequestRefreshRows.fire(Math.min(viewportStart, this._bufferService.rows - 1), Math.min(viewportEnd, this._bufferService.rows - 1));
503
+ this._onRequestRefreshRows.fire({
504
+ start: Math.min(viewportStart, this._bufferService.rows - 1),
505
+ end: Math.min(viewportEnd, this._bufferService.rows - 1)
506
+ });
504
507
  }
505
508
  }
506
509
 
@@ -1943,7 +1946,7 @@ export class InputHandler extends Disposable implements IInputHandler {
1943
1946
  case 1047: // alt screen buffer
1944
1947
  this._bufferService.buffers.activateAltBuffer(this._eraseAttrData());
1945
1948
  this._coreService.isCursorInitialized = true;
1946
- this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1);
1949
+ this._onRequestRefreshRows.fire(undefined);
1947
1950
  this._onRequestSyncScrollBar.fire();
1948
1951
  break;
1949
1952
  case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)
@@ -2171,7 +2174,7 @@ export class InputHandler extends Disposable implements IInputHandler {
2171
2174
  this.restoreCursor();
2172
2175
  }
2173
2176
  this._coreService.isCursorInitialized = true;
2174
- this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1);
2177
+ this._onRequestRefreshRows.fire(undefined);
2175
2178
  this._onRequestSyncScrollBar.fire();
2176
2179
  break;
2177
2180
  case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)
@@ -4,12 +4,12 @@
4
4
  */
5
5
 
6
6
  import { IDeleteEvent, IInsertEvent } from 'common/CircularList';
7
- import { IEvent, IEventEmitter } from 'common/EventEmitter';
8
7
  import { Attributes, UnderlineStyle } from 'common/buffer/Constants'; // eslint-disable-line no-unused-vars
9
8
  import { IBufferSet } from 'common/buffer/Types';
10
9
  import { IParams } from 'common/parser/Types';
11
10
  import { ICoreMouseService, ICoreService, IOptionsService, IUnicodeService } from 'common/services/Services';
12
11
  import { IFunctionIdentifier, ITerminalOptions as IPublicTerminalOptions } from '@xterm/xterm';
12
+ import type { Emitter, Event } from 'vs/base/common/event';
13
13
 
14
14
  export interface ICoreTerminal {
15
15
  coreMouseService: ICoreMouseService;
@@ -67,12 +67,12 @@ export interface ICircularList<T> {
67
67
  maxLength: number;
68
68
  isFull: boolean;
69
69
 
70
- onDeleteEmitter: IEventEmitter<IDeleteEvent>;
71
- onDelete: IEvent<IDeleteEvent>;
72
- onInsertEmitter: IEventEmitter<IInsertEvent>;
73
- onInsert: IEvent<IInsertEvent>;
74
- onTrimEmitter: IEventEmitter<number>;
75
- onTrim: IEvent<number>;
70
+ onDeleteEmitter: Emitter<IDeleteEvent>;
71
+ onDelete: Event<IDeleteEvent>;
72
+ onInsertEmitter: Emitter<IInsertEvent>;
73
+ onInsert: Event<IInsertEvent>;
74
+ onTrimEmitter: Emitter<number>;
75
+ onTrim: Event<number>;
76
76
 
77
77
  get(index: number): T | undefined;
78
78
  set(index: number, value: T): void;
@@ -258,7 +258,7 @@ export interface IMarker extends IDisposable {
258
258
  readonly id: number;
259
259
  readonly isDisposed: boolean;
260
260
  readonly line: number;
261
- onDispose: IEvent<void>;
261
+ onDispose: Event<void>;
262
262
  }
263
263
  export interface IModes {
264
264
  insertMode: boolean;
@@ -446,7 +446,7 @@ export type IColorEvent = (IColorReportRequest | IColorSetRequest | IColorRestor
446
446
  * Calls the parser and handles actions generated by the parser.
447
447
  */
448
448
  export interface IInputHandler {
449
- onTitleChange: IEvent<string>;
449
+ onTitleChange: Event<string>;
450
450
 
451
451
  parse(data: string | Uint8Array, promiseResult?: boolean): void | Promise<boolean>;
452
452
  print(data: Uint32Array, start: number, end: number): void;
@@ -161,6 +161,10 @@ export class Buffer implements IBuffer {
161
161
  this.lines.maxLength = newMaxLength;
162
162
  }
163
163
 
164
+ // if (this._cols > newCols) {
165
+ // console.log('increase!');
166
+ // }
167
+
164
168
  // The following adjustments should only happen if the buffer has been
165
169
  // initialized/filled.
166
170
  if (this.lines.length > 0) {
@@ -3,12 +3,12 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { EventEmitter } from 'common/EventEmitter';
7
6
  import { Disposable } from 'common/Lifecycle';
8
7
  import { IAttributeData } from 'common/Types';
9
8
  import { Buffer } from 'common/buffer/Buffer';
10
9
  import { IBuffer, IBufferSet } from 'common/buffer/Types';
11
10
  import { IBufferService, IOptionsService } from 'common/services/Services';
11
+ import { Emitter } from 'vs/base/common/event';
12
12
 
13
13
  /**
14
14
  * The BufferSet represents the set of two buffers used by xterm terminals (normal and alt) and
@@ -19,7 +19,7 @@ export class BufferSet extends Disposable implements IBufferSet {
19
19
  private _alt!: Buffer;
20
20
  private _activeBuffer!: Buffer;
21
21
 
22
- private readonly _onBufferActivate = this.register(new EventEmitter<{activeBuffer: IBuffer, inactiveBuffer: IBuffer}>());
22
+ private readonly _onBufferActivate = this.register(new Emitter<{ activeBuffer: IBuffer, inactiveBuffer: IBuffer }>());
23
23
  public readonly onBufferActivate = this._onBufferActivate.event;
24
24
 
25
25
  /**
@@ -3,9 +3,9 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { EventEmitter } from 'common/EventEmitter';
7
6
  import { disposeArray } from 'common/Lifecycle';
8
7
  import { IDisposable, IMarker } from 'common/Types';
8
+ import { Emitter } from 'vs/base/common/event';
9
9
 
10
10
  export class Marker implements IMarker {
11
11
  private static _nextId = 1;
@@ -16,7 +16,7 @@ export class Marker implements IMarker {
16
16
  private readonly _id: number = Marker._nextId++;
17
17
  public get id(): number { return this._id; }
18
18
 
19
- private readonly _onDispose = this.register(new EventEmitter<void>());
19
+ private readonly _onDispose = this.register(new Emitter<void>());
20
20
  public readonly onDispose = this._onDispose.event;
21
21
 
22
22
  constructor(
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { IAttributeData, ICircularList, IBufferLine, ICellData, IMarker, ICharset, IDisposable } from 'common/Types';
7
- import { IEvent } from 'common/EventEmitter';
7
+ import type { Event } from 'vs/base/common/event';
8
8
 
9
9
  // BufferIndex denotes a position in the buffer: [rowIndex, colIndex]
10
10
  export type BufferIndex = [number, number];
@@ -42,7 +42,7 @@ export interface IBufferSet extends IDisposable {
42
42
  normal: IBuffer;
43
43
  active: IBuffer;
44
44
 
45
- onBufferActivate: IEvent<{ activeBuffer: IBuffer, inactiveBuffer: IBuffer }>;
45
+ onBufferActivate: Event<{ activeBuffer: IBuffer, inactiveBuffer: IBuffer }>;
46
46
 
47
47
  activateNormalBuffer(): void;
48
48
  activateAltBuffer(fillAttr?: IAttributeData): void;
@@ -4,8 +4,8 @@
4
4
  * @license MIT
5
5
  */
6
6
 
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
  declare const setTimeout: (handler: () => void, timeout?: number) => void;
11
11
 
@@ -43,7 +43,7 @@ export class WriteBuffer extends Disposable {
43
43
  private _syncCalls = 0;
44
44
  private _didUserInput = false;
45
45
 
46
- private readonly _onWriteParsed = this.register(new EventEmitter<void>());
46
+ private readonly _onWriteParsed = this.register(new Emitter<void>());
47
47
  public readonly onWriteParsed = this._onWriteParsed.event;
48
48
 
49
49
  constructor(private _action: (data: string | Uint8Array, promiseResult?: boolean) => void | Promise<boolean>) {
@@ -5,15 +5,15 @@
5
5
 
6
6
  import { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from '@xterm/xterm';
7
7
  import { BufferApiView } from 'common/public/BufferApiView';
8
- import { EventEmitter } from 'common/EventEmitter';
9
8
  import { ICoreTerminal } from 'common/Types';
10
9
  import { Disposable } from 'common/Lifecycle';
10
+ import { Emitter } from 'vs/base/common/event';
11
11
 
12
12
  export class BufferNamespaceApi extends Disposable implements IBufferNamespaceApi {
13
13
  private _normal: BufferApiView;
14
14
  private _alternate: BufferApiView;
15
15
 
16
- private readonly _onBufferChange = this.register(new EventEmitter<IBufferApi>());
16
+ private readonly _onBufferChange = this.register(new Emitter<IBufferApi>());
17
17
  public readonly onBufferChange = this._onBufferChange.event;
18
18
 
19
19
  constructor(private _core: ICoreTerminal) {
@@ -3,12 +3,12 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { EventEmitter } from 'common/EventEmitter';
7
6
  import { Disposable } from 'common/Lifecycle';
8
7
  import { IAttributeData, IBufferLine } from 'common/Types';
9
8
  import { BufferSet } from 'common/buffer/BufferSet';
10
9
  import { IBuffer, IBufferSet } from 'common/buffer/Types';
11
10
  import { IBufferService, IOptionsService } from 'common/services/Services';
11
+ import { Emitter } from 'vs/base/common/event';
12
12
 
13
13
  export const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars
14
14
  export const MINIMUM_ROWS = 1;
@@ -22,9 +22,9 @@ export class BufferService extends Disposable implements IBufferService {
22
22
  /** Whether the user is scrolling (locks the scroll position) */
23
23
  public isUserScrolling: boolean = false;
24
24
 
25
- private readonly _onResize = this.register(new EventEmitter<{ cols: number, rows: number }>());
25
+ private readonly _onResize = this.register(new Emitter<{ cols: number, rows: number }>());
26
26
  public readonly onResize = this._onResize.event;
27
- private readonly _onScroll = this.register(new EventEmitter<number>());
27
+ private readonly _onScroll = this.register(new Emitter<number>());
28
28
  public readonly onScroll = this._onScroll.event;
29
29
 
30
30
  public get buffer(): IBuffer { return this.buffers.active; }
@@ -3,9 +3,9 @@
3
3
  * @license MIT
4
4
  */
5
5
  import { IBufferService, ICoreService, ICoreMouseService } from 'common/services/Services';
6
- import { EventEmitter } from 'common/EventEmitter';
7
6
  import { ICoreMouseProtocol, ICoreMouseEvent, CoreMouseEncoding, CoreMouseEventType, CoreMouseButton, CoreMouseAction } from 'common/Types';
8
7
  import { Disposable } from 'common/Lifecycle';
8
+ import { Emitter } from 'vs/base/common/event';
9
9
 
10
10
  /**
11
11
  * Supported default protocols.
@@ -175,7 +175,7 @@ export class CoreMouseService extends Disposable implements ICoreMouseService {
175
175
  private _activeEncoding: string = '';
176
176
  private _lastEvent: ICoreMouseEvent | null = null;
177
177
 
178
- private readonly _onProtocolChange = this.register(new EventEmitter<CoreMouseEventType>());
178
+ private readonly _onProtocolChange = this.register(new Emitter<CoreMouseEventType>());
179
179
  public readonly onProtocolChange = this._onProtocolChange.event;
180
180
 
181
181
  constructor(
@@ -4,10 +4,10 @@
4
4
  */
5
5
 
6
6
  import { clone } from 'common/Clone';
7
- import { EventEmitter } from 'common/EventEmitter';
8
7
  import { Disposable } from 'common/Lifecycle';
9
8
  import { IDecPrivateModes, IModes } from 'common/Types';
10
9
  import { IBufferService, ICoreService, ILogService, IOptionsService } from 'common/services/Services';
10
+ import { Emitter } from 'vs/base/common/event';
11
11
 
12
12
  const DEFAULT_MODES: IModes = Object.freeze({
13
13
  insertMode: false
@@ -31,13 +31,13 @@ export class CoreService extends Disposable implements ICoreService {
31
31
  public modes: IModes;
32
32
  public decPrivateModes: IDecPrivateModes;
33
33
 
34
- private readonly _onData = this.register(new EventEmitter<string>());
34
+ private readonly _onData = this.register(new Emitter<string>());
35
35
  public readonly onData = this._onData.event;
36
- private readonly _onUserInput = this.register(new EventEmitter<void>());
36
+ private readonly _onUserInput = this.register(new Emitter<void>());
37
37
  public readonly onUserInput = this._onUserInput.event;
38
- private readonly _onBinary = this.register(new EventEmitter<string>());
38
+ private readonly _onBinary = this.register(new Emitter<string>());
39
39
  public readonly onBinary = this._onBinary.event;
40
- private readonly _onRequestScrollToBottom = this.register(new EventEmitter<void>());
40
+ private readonly _onRequestScrollToBottom = this.register(new Emitter<void>());
41
41
  public readonly onRequestScrollToBottom = this._onRequestScrollToBottom.event;
42
42
 
43
43
  constructor(
@@ -4,12 +4,12 @@
4
4
  */
5
5
 
6
6
  import { css } from 'common/Color';
7
- import { EventEmitter } from 'common/EventEmitter';
8
7
  import { Disposable, toDisposable } from 'common/Lifecycle';
9
8
  import { IDecorationService, IInternalDecoration } from 'common/services/Services';
10
9
  import { SortedList } from 'common/SortedList';
11
10
  import { IColor } from 'common/Types';
12
11
  import { IDecoration, IDecorationOptions, IMarker } from '@xterm/xterm';
12
+ import { Emitter } from 'vs/base/common/event';
13
13
 
14
14
  // Work variables to avoid garbage collection
15
15
  let $xmin = 0;
@@ -25,9 +25,9 @@ export class DecorationService extends Disposable implements IDecorationService
25
25
  */
26
26
  private readonly _decorations: SortedList<IInternalDecoration> = new SortedList(e => e?.marker.line);
27
27
 
28
- private readonly _onDecorationRegistered = this.register(new EventEmitter<IInternalDecoration>());
28
+ private readonly _onDecorationRegistered = this.register(new Emitter<IInternalDecoration>());
29
29
  public readonly onDecorationRegistered = this._onDecorationRegistered.event;
30
- private readonly _onDecorationRemoved = this.register(new EventEmitter<IInternalDecoration>());
30
+ private readonly _onDecorationRemoved = this.register(new Emitter<IInternalDecoration>());
31
31
  public readonly onDecorationRemoved = this._onDecorationRemoved.event;
32
32
 
33
33
  public get decorations(): IterableIterator<IInternalDecoration> { return this._decorations.values(); }
@@ -95,9 +95,9 @@ class Decoration extends Disposable implements IInternalDecoration {
95
95
  public element: HTMLElement | undefined;
96
96
  public get isDisposed(): boolean { return this._isDisposed; }
97
97
 
98
- public readonly onRenderEmitter = this.register(new EventEmitter<HTMLElement>());
98
+ public readonly onRenderEmitter = this.register(new Emitter<HTMLElement>());
99
99
  public readonly onRender = this.onRenderEmitter.event;
100
- private readonly _onDispose = this.register(new EventEmitter<void>());
100
+ private readonly _onDispose = this.register(new Emitter<void>());
101
101
  public readonly onDispose = this._onDispose.event;
102
102
 
103
103
  private _cachedBg: IColor | undefined | null = null;
@@ -3,11 +3,11 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { EventEmitter } from 'common/EventEmitter';
7
6
  import { Disposable, toDisposable } from 'common/Lifecycle';
8
7
  import { isMac } from 'common/Platform';
9
8
  import { CursorStyle, IDisposable } from 'common/Types';
10
9
  import { FontWeight, IOptionsService, ITerminalOptions } from 'common/services/Services';
10
+ import { Emitter } from 'vs/base/common/event';
11
11
 
12
12
  export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
13
13
  cols: 80,
@@ -65,7 +65,7 @@ export class OptionsService extends Disposable implements IOptionsService {
65
65
  public readonly rawOptions: Required<ITerminalOptions>;
66
66
  public options: Required<ITerminalOptions>;
67
67
 
68
- private readonly _onOptionChange = this.register(new EventEmitter<keyof ITerminalOptions>());
68
+ private readonly _onOptionChange = this.register(new Emitter<keyof ITerminalOptions>());
69
69
  public readonly onOptionChange = this._onOptionChange.event;
70
70
 
71
71
  constructor(options: Partial<ITerminalOptions>) {
@@ -4,10 +4,10 @@
4
4
  */
5
5
 
6
6
  import { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty } from '@xterm/xterm';
7
- import { IEvent, IEventEmitter } from 'common/EventEmitter';
8
7
  import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IModes, IOscLinkData, IWindowOptions } from 'common/Types';
9
8
  import { IBuffer, IBufferSet } from 'common/buffer/Types';
10
9
  import { createDecorator } from 'common/services/ServiceRegistry';
10
+ import type { Emitter, Event } from 'vs/base/common/event';
11
11
 
12
12
  export const IBufferService = createDecorator<IBufferService>('BufferService');
13
13
  export interface IBufferService {
@@ -18,8 +18,8 @@ export interface IBufferService {
18
18
  readonly buffer: IBuffer;
19
19
  readonly buffers: IBufferSet;
20
20
  isUserScrolling: boolean;
21
- onResize: IEvent<{ cols: number, rows: number }>;
22
- onScroll: IEvent<number>;
21
+ onResize: Event<{ cols: number, rows: number }>;
22
+ onScroll: Event<number>;
23
23
  scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;
24
24
  scrollLines(disp: number, suppressScrollEvent?: boolean): void;
25
25
  resize(cols: number, rows: number): void;
@@ -52,7 +52,7 @@ export interface ICoreMouseService {
52
52
  /**
53
53
  * Event to announce changes in mouse tracking.
54
54
  */
55
- onProtocolChange: IEvent<CoreMouseEventType>;
55
+ onProtocolChange: Event<CoreMouseEventType>;
56
56
 
57
57
  /**
58
58
  * Human readable version of mouse events.
@@ -74,10 +74,10 @@ export interface ICoreService {
74
74
  readonly modes: IModes;
75
75
  readonly decPrivateModes: IDecPrivateModes;
76
76
 
77
- readonly onData: IEvent<string>;
78
- readonly onUserInput: IEvent<void>;
79
- readonly onBinary: IEvent<string>;
80
- readonly onRequestScrollToBottom: IEvent<void>;
77
+ readonly onData: Event<string>;
78
+ readonly onUserInput: Event<void>;
79
+ readonly onBinary: Event<string>;
80
+ readonly onRequestScrollToBottom: Event<void>;
81
81
 
82
82
  reset(): void;
83
83
 
@@ -186,7 +186,7 @@ export interface IOptionsService {
186
186
  /**
187
187
  * Adds an event listener for when any option changes.
188
188
  */
189
- readonly onOptionChange: IEvent<keyof ITerminalOptions>;
189
+ readonly onOptionChange: Event<keyof ITerminalOptions>;
190
190
 
191
191
  /**
192
192
  * Adds an event listener for when a specific option changes, this is a convenience method that is
@@ -338,7 +338,7 @@ export interface IUnicodeService {
338
338
  /** Currently active version. */
339
339
  activeVersion: string;
340
340
  /** Event triggered, when activate version changed. */
341
- readonly onChange: IEvent<string>;
341
+ readonly onChange: Event<string>;
342
342
 
343
343
  /**
344
344
  * Unicode version dependent
@@ -363,8 +363,8 @@ export const IDecorationService = createDecorator<IDecorationService>('Decoratio
363
363
  export interface IDecorationService extends IDisposable {
364
364
  serviceBrand: undefined;
365
365
  readonly decorations: IterableIterator<IInternalDecoration>;
366
- readonly onDecorationRegistered: IEvent<IInternalDecoration>;
367
- readonly onDecorationRemoved: IEvent<IInternalDecoration>;
366
+ readonly onDecorationRegistered: Event<IInternalDecoration>;
367
+ readonly onDecorationRemoved: Event<IInternalDecoration>;
368
368
  registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;
369
369
  reset(): void;
370
370
  /**
@@ -377,5 +377,5 @@ export interface IInternalDecoration extends IDecoration {
377
377
  readonly options: IDecorationOptions;
378
378
  readonly backgroundColorRGB: IColor | undefined;
379
379
  readonly foregroundColorRGB: IColor | undefined;
380
- readonly onRenderEmitter: IEventEmitter<HTMLElement>;
380
+ readonly onRenderEmitter: Emitter<HTMLElement>;
381
381
  }
@@ -3,9 +3,9 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { EventEmitter } from 'common/EventEmitter';
7
6
  import { UnicodeV6 } from 'common/input/UnicodeV6';
8
7
  import { IUnicodeService, IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';
8
+ import { Emitter } from 'vs/base/common/event';
9
9
 
10
10
  export class UnicodeService implements IUnicodeService {
11
11
  public serviceBrand: any;
@@ -14,7 +14,7 @@ export class UnicodeService implements IUnicodeService {
14
14
  private _active: string = '';
15
15
  private _activeProvider: IUnicodeVersionProvider;
16
16
 
17
- private readonly _onChange = new EventEmitter<string>();
17
+ private readonly _onChange = new Emitter<string>();
18
18
  public readonly onChange = this._onChange.event;
19
19
 
20
20
  public static extractShouldJoin(value: UnicodeCharProperties): boolean {
@@ -615,6 +615,22 @@ export namespace Event {
615
615
  return result.event;
616
616
  }
617
617
 
618
+ /**
619
+ * A convenience function for forwarding an event to another emitter which
620
+ * improves readability.allows Event.forward(event, emitter) instead of `event(e => emitter.fire(e))`.
621
+ * @param from The event to forward.
622
+ * @param to The emitter to forward the event to.
623
+ * @example
624
+ * Event.forward(event, emitter);
625
+ * // equivalent to
626
+ * event(e => emitter.fire(e));
627
+ * // equivalent to
628
+ * event(emitter.fire, emitter);
629
+ */
630
+ export function forward<T>(from: Event<T>, to: Emitter<T>): IDisposable {
631
+ return from(e => to.fire(e));
632
+ }
633
+
618
634
  /**
619
635
  * Adds a listener to an event and calls the listener immediately with undefined as the event object.
620
636
  *