@xterm/xterm 5.6.0-beta.5 → 5.6.0-beta.50

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 (112) hide show
  1. package/README.md +6 -3
  2. package/css/xterm.css +71 -4
  3. package/lib/xterm.js +1 -1
  4. package/lib/xterm.js.map +1 -1
  5. package/lib/xterm.mjs +53 -0
  6. package/lib/xterm.mjs.map +7 -0
  7. package/package.json +40 -31
  8. package/src/browser/AccessibilityManager.ts +39 -11
  9. package/src/browser/{Terminal.ts → CoreBrowserTerminal.ts} +85 -97
  10. package/src/browser/Linkifier.ts +3 -3
  11. package/src/browser/LocalizableStrings.ts +15 -4
  12. package/src/browser/{Types.d.ts → Types.ts} +67 -15
  13. package/src/browser/Viewport.ts +142 -364
  14. package/src/browser/decorations/BufferDecorationRenderer.ts +6 -1
  15. package/src/browser/decorations/OverviewRulerRenderer.ts +32 -36
  16. package/src/browser/public/Terminal.ts +21 -15
  17. package/src/browser/renderer/dom/DomRenderer.ts +8 -10
  18. package/src/browser/renderer/shared/CharAtlasUtils.ts +4 -0
  19. package/src/browser/renderer/shared/CustomGlyphs.ts +6 -0
  20. package/src/browser/renderer/shared/TextureAtlas.ts +3 -3
  21. package/src/browser/renderer/shared/{Types.d.ts → Types.ts} +4 -4
  22. package/src/browser/services/CharSizeService.ts +2 -2
  23. package/src/browser/services/CoreBrowserService.ts +13 -9
  24. package/src/browser/services/RenderService.ts +5 -5
  25. package/src/browser/services/SelectionService.ts +5 -5
  26. package/src/browser/services/Services.ts +13 -13
  27. package/src/browser/services/ThemeService.ts +14 -53
  28. package/src/browser/shared/Constants.ts +8 -0
  29. package/src/common/CircularList.ts +4 -4
  30. package/src/common/CoreTerminal.ts +22 -28
  31. package/src/common/InputHandler.ts +31 -25
  32. package/src/common/{Types.d.ts → Types.ts} +11 -17
  33. package/src/common/buffer/Buffer.ts +5 -1
  34. package/src/common/buffer/BufferSet.ts +2 -2
  35. package/src/common/buffer/Marker.ts +2 -2
  36. package/src/common/buffer/{Types.d.ts → Types.ts} +2 -2
  37. package/src/common/input/WriteBuffer.ts +2 -2
  38. package/src/common/public/BufferNamespaceApi.ts +2 -2
  39. package/src/common/services/BufferService.ts +5 -5
  40. package/src/common/services/CoreMouseService.ts +4 -2
  41. package/src/common/services/CoreService.ts +5 -5
  42. package/src/common/services/DecorationService.ts +5 -5
  43. package/src/common/services/OptionsService.ts +3 -3
  44. package/src/common/services/Services.ts +24 -17
  45. package/src/common/services/UnicodeService.ts +2 -2
  46. package/src/vs/base/browser/browser.ts +141 -0
  47. package/src/vs/base/browser/canIUse.ts +49 -0
  48. package/src/vs/base/browser/dom.ts +2369 -0
  49. package/src/vs/base/browser/fastDomNode.ts +316 -0
  50. package/src/vs/base/browser/globalPointerMoveMonitor.ts +112 -0
  51. package/src/vs/base/browser/iframe.ts +135 -0
  52. package/src/vs/base/browser/keyboardEvent.ts +213 -0
  53. package/src/vs/base/browser/mouseEvent.ts +229 -0
  54. package/src/vs/base/browser/touch.ts +372 -0
  55. package/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +303 -0
  56. package/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +114 -0
  57. package/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +720 -0
  58. package/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +165 -0
  59. package/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +114 -0
  60. package/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +243 -0
  61. package/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts +118 -0
  62. package/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +116 -0
  63. package/src/vs/base/browser/ui/widget.ts +57 -0
  64. package/src/vs/base/browser/window.ts +14 -0
  65. package/src/vs/base/common/arrays.ts +887 -0
  66. package/src/vs/base/common/arraysFind.ts +202 -0
  67. package/src/vs/base/common/assert.ts +71 -0
  68. package/src/vs/base/common/async.ts +1992 -0
  69. package/src/vs/base/common/cancellation.ts +148 -0
  70. package/src/vs/base/common/charCode.ts +450 -0
  71. package/src/vs/base/common/collections.ts +140 -0
  72. package/src/vs/base/common/decorators.ts +130 -0
  73. package/src/vs/base/common/equals.ts +146 -0
  74. package/src/vs/base/common/errors.ts +303 -0
  75. package/src/vs/base/common/event.ts +1778 -0
  76. package/src/vs/base/common/functional.ts +32 -0
  77. package/src/vs/base/common/hash.ts +316 -0
  78. package/src/vs/base/common/iterator.ts +159 -0
  79. package/src/vs/base/common/keyCodes.ts +526 -0
  80. package/src/vs/base/common/keybindings.ts +284 -0
  81. package/src/vs/base/common/lazy.ts +47 -0
  82. package/src/vs/base/common/lifecycle.ts +801 -0
  83. package/src/vs/base/common/linkedList.ts +142 -0
  84. package/src/vs/base/common/map.ts +202 -0
  85. package/src/vs/base/common/numbers.ts +98 -0
  86. package/src/vs/base/common/observable.ts +76 -0
  87. package/src/vs/base/common/observableInternal/api.ts +31 -0
  88. package/src/vs/base/common/observableInternal/autorun.ts +281 -0
  89. package/src/vs/base/common/observableInternal/base.ts +489 -0
  90. package/src/vs/base/common/observableInternal/debugName.ts +145 -0
  91. package/src/vs/base/common/observableInternal/derived.ts +428 -0
  92. package/src/vs/base/common/observableInternal/lazyObservableValue.ts +146 -0
  93. package/src/vs/base/common/observableInternal/logging.ts +328 -0
  94. package/src/vs/base/common/observableInternal/promise.ts +209 -0
  95. package/src/vs/base/common/observableInternal/utils.ts +610 -0
  96. package/src/vs/base/common/platform.ts +281 -0
  97. package/src/vs/base/common/scrollable.ts +522 -0
  98. package/src/vs/base/common/sequence.ts +34 -0
  99. package/src/vs/base/common/stopwatch.ts +43 -0
  100. package/src/vs/base/common/strings.ts +557 -0
  101. package/src/vs/base/common/symbols.ts +9 -0
  102. package/src/vs/base/common/uint.ts +59 -0
  103. package/src/vs/patches/nls.ts +90 -0
  104. package/src/vs/typings/base-common.d.ts +20 -0
  105. package/src/vs/typings/require.d.ts +42 -0
  106. package/src/vs/typings/thenable.d.ts +12 -0
  107. package/src/vs/typings/vscode-globals-nls.d.ts +36 -0
  108. package/src/vs/typings/vscode-globals-product.d.ts +33 -0
  109. package/typings/xterm.d.ts +59 -15
  110. package/src/common/EventEmitter.ts +0 -78
  111. /package/src/browser/selection/{Types.d.ts → Types.ts} +0 -0
  112. /package/src/common/parser/{Types.d.ts → Types.ts} +0 -0
@@ -5,12 +5,12 @@
5
5
 
6
6
  import { ColorContrastCache } from 'browser/ColorContrastCache';
7
7
  import { IThemeService } from 'browser/services/Services';
8
- import { IColorContrastCache, IColorSet, ReadonlyColorSet } from 'browser/Types';
9
- import { channels, color, css, NULL_COLOR } from 'common/Color';
10
- import { EventEmitter } from 'common/EventEmitter';
8
+ import { DEFAULT_ANSI_COLORS, IColorContrastCache, IColorSet, ReadonlyColorSet } from 'browser/Types';
9
+ import { color, css, NULL_COLOR } from 'common/Color';
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;
@@ -23,59 +23,12 @@ interface IRestoreColorSet {
23
23
  const DEFAULT_FOREGROUND = css.toColor('#ffffff');
24
24
  const DEFAULT_BACKGROUND = css.toColor('#000000');
25
25
  const DEFAULT_CURSOR = css.toColor('#ffffff');
26
- const DEFAULT_CURSOR_ACCENT = css.toColor('#000000');
26
+ const DEFAULT_CURSOR_ACCENT = DEFAULT_BACKGROUND;
27
27
  const DEFAULT_SELECTION = {
28
28
  css: 'rgba(255, 255, 255, 0.3)',
29
29
  rgba: 0xFFFFFF4D
30
30
  };
31
-
32
- // An IIFE to generate DEFAULT_ANSI_COLORS.
33
- export const DEFAULT_ANSI_COLORS = Object.freeze((() => {
34
- const colors = [
35
- // dark:
36
- css.toColor('#2e3436'),
37
- css.toColor('#cc0000'),
38
- css.toColor('#4e9a06'),
39
- css.toColor('#c4a000'),
40
- css.toColor('#3465a4'),
41
- css.toColor('#75507b'),
42
- css.toColor('#06989a'),
43
- css.toColor('#d3d7cf'),
44
- // bright:
45
- css.toColor('#555753'),
46
- css.toColor('#ef2929'),
47
- css.toColor('#8ae234'),
48
- css.toColor('#fce94f'),
49
- css.toColor('#729fcf'),
50
- css.toColor('#ad7fa8'),
51
- css.toColor('#34e2e2'),
52
- css.toColor('#eeeeec')
53
- ];
54
-
55
- // Fill in the remaining 240 ANSI colors.
56
- // Generate colors (16-231)
57
- const v = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff];
58
- for (let i = 0; i < 216; i++) {
59
- const r = v[(i / 36) % 6 | 0];
60
- const g = v[(i / 6) % 6 | 0];
61
- const b = v[i % 6];
62
- colors.push({
63
- css: channels.toCss(r, g, b),
64
- rgba: channels.toRgba(r, g, b)
65
- });
66
- }
67
-
68
- // Generate greys (232-255)
69
- for (let i = 0; i < 24; i++) {
70
- const c = 8 + i * 10;
71
- colors.push({
72
- css: channels.toCss(c, c, c),
73
- rgba: channels.toRgba(c, c, c)
74
- });
75
- }
76
-
77
- return colors;
78
- })());
31
+ const DEFAULT_OVERVIEW_RULER_BORDER = DEFAULT_FOREGROUND;
79
32
 
80
33
  export class ThemeService extends Disposable implements IThemeService {
81
34
  public serviceBrand: undefined;
@@ -87,7 +40,7 @@ export class ThemeService extends Disposable implements IThemeService {
87
40
 
88
41
  public get colors(): ReadonlyColorSet { return this._colors; }
89
42
 
90
- private readonly _onChangeColors = this.register(new EventEmitter<ReadonlyColorSet>());
43
+ private readonly _onChangeColors = this.register(new Emitter<ReadonlyColorSet>());
91
44
  public readonly onChangeColors = this._onChangeColors.event;
92
45
 
93
46
  constructor(
@@ -105,6 +58,10 @@ export class ThemeService extends Disposable implements IThemeService {
105
58
  selectionBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),
106
59
  selectionInactiveBackgroundTransparent: DEFAULT_SELECTION,
107
60
  selectionInactiveBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),
61
+ scrollbarSliderBackground: color.opacity(DEFAULT_FOREGROUND, 0.2),
62
+ scrollbarSliderHoverBackground: color.opacity(DEFAULT_FOREGROUND, 0.4),
63
+ scrollbarSliderActiveBackground: color.opacity(DEFAULT_FOREGROUND, 0.5),
64
+ overviewRulerBorder: DEFAULT_FOREGROUND,
108
65
  ansi: DEFAULT_ANSI_COLORS.slice(),
109
66
  contrastCache: this._contrastCache,
110
67
  halfContrastCache: this._halfContrastCache
@@ -148,6 +105,10 @@ export class ThemeService extends Disposable implements IThemeService {
148
105
  const opacity = 0.3;
149
106
  colors.selectionInactiveBackgroundTransparent = color.opacity(colors.selectionInactiveBackgroundTransparent, opacity);
150
107
  }
108
+ colors.scrollbarSliderBackground = parseColor(theme.scrollbarSliderBackground, color.opacity(colors.foreground, 0.2));
109
+ colors.scrollbarSliderHoverBackground = parseColor(theme.scrollbarSliderHoverBackground, color.opacity(colors.foreground, 0.4));
110
+ colors.scrollbarSliderActiveBackground = parseColor(theme.scrollbarSliderActiveBackground, color.opacity(colors.foreground, 0.5));
111
+ colors.overviewRulerBorder = parseColor(theme.overviewRulerBorder, DEFAULT_OVERVIEW_RULER_BORDER);
151
112
  colors.ansi = DEFAULT_ANSI_COLORS.slice();
152
113
  colors.ansi[0] = parseColor(theme.black, DEFAULT_ANSI_COLORS[0]);
153
114
  colors.ansi[1] = parseColor(theme.red, DEFAULT_ANSI_COLORS[1]);
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) 2024 The xterm.js authors. All rights reserved.
3
+ * @license MIT
4
+ */
5
+
6
+ export const enum ViewportConstants {
7
+ DEFAULT_SCROLL_BAR_WIDTH = 14
8
+ }
@@ -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(
@@ -27,9 +27,8 @@ import { InstantiationService } from 'common/services/InstantiationService';
27
27
  import { LogService } from 'common/services/LogService';
28
28
  import { BufferService, MINIMUM_COLS, MINIMUM_ROWS } from 'common/services/BufferService';
29
29
  import { OptionsService } from 'common/services/OptionsService';
30
- import { IDisposable, IAttributeData, ICoreTerminal, IScrollEvent, ScrollSource } from 'common/Types';
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,28 +123,23 @@ 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));
133
- this.register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom()));
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
+ 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()));
136
- this.register(this._bufferService.onScroll(event => {
137
- this._onScroll.fire({ position: this._bufferService.buffer.ydisp, source: ScrollSource.TERMINAL });
136
+ this.register(this._bufferService.onScroll(() => {
137
+ this._onScroll.fire({ position: this._bufferService.buffer.ydisp });
138
138
  this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);
139
139
  }));
140
- this.register(this._inputHandler.onScroll(event => {
141
- this._onScroll.fire({ position: this._bufferService.buffer.ydisp, source: ScrollSource.TERMINAL });
142
- this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);
143
- }));
144
-
145
140
  // Setup WriteBuffer
146
141
  this._writeBuffer = this.register(new WriteBuffer((data, promiseResult) => this._inputHandler.parse(data, promiseResult)));
147
- this.register(forwardEvent(this._writeBuffer.onWriteParsed, this._onWriteParsed));
142
+ this.register(Event.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));
148
143
  }
149
144
 
150
145
  public write(data: string | Uint8Array, callback?: () => void): void {
@@ -198,10 +193,9 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
198
193
  * @param suppressScrollEvent Don't emit the scroll event as scrollLines. This is used to avoid
199
194
  * unwanted events being handled by the viewport when the event was triggered from the viewport
200
195
  * originally.
201
- * @param source Which component the event came from.
202
196
  */
203
- public scrollLines(disp: number, suppressScrollEvent?: boolean, source?: ScrollSource): void {
204
- this._bufferService.scrollLines(disp, suppressScrollEvent, source);
197
+ public scrollLines(disp: number, suppressScrollEvent?: boolean): void {
198
+ this._bufferService.scrollLines(disp, suppressScrollEvent);
205
199
  }
206
200
 
207
201
  public scrollPages(pageCount: number): void {
@@ -212,7 +206,7 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
212
206
  this.scrollLines(-this._bufferService.buffer.ydisp);
213
207
  }
214
208
 
215
- public scrollToBottom(): void {
209
+ public scrollToBottom(disableSmoothScroll?: boolean): void {
216
210
  this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);
217
211
  }
218
212
 
@@ -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`.
@@ -119,7 +119,6 @@ export class InputHandler extends Disposable implements IInputHandler {
119
119
  private _parseBuffer: Uint32Array = new Uint32Array(4096);
120
120
  private _stringDecoder: StringToUtf32 = new StringToUtf32();
121
121
  private _utf8Decoder: Utf8ToUtf32 = new Utf8ToUtf32();
122
- private _workCell: CellData = new CellData();
123
122
  private _windowTitle = '';
124
123
  private _iconName = '';
125
124
  private _dirtyRowTracker: IDirtyRowTracker;
@@ -132,32 +131,32 @@ export class InputHandler extends Disposable implements IInputHandler {
132
131
 
133
132
  private _activeBuffer: IBuffer;
134
133
 
135
- private readonly _onRequestBell = this.register(new EventEmitter<void>());
134
+ private readonly _onRequestBell = this.register(new Emitter<void>());
136
135
  public readonly onRequestBell = this._onRequestBell.event;
137
- private readonly _onRequestRefreshRows = this.register(new EventEmitter<number, number>());
136
+ private readonly _onRequestRefreshRows = this.register(new Emitter<{ start: number, end: number } | undefined>());
138
137
  public readonly onRequestRefreshRows = this._onRequestRefreshRows.event;
139
- private readonly _onRequestReset = this.register(new EventEmitter<void>());
138
+ private readonly _onRequestReset = this.register(new Emitter<void>());
140
139
  public readonly onRequestReset = this._onRequestReset.event;
141
- private readonly _onRequestSendFocus = this.register(new EventEmitter<void>());
140
+ private readonly _onRequestSendFocus = this.register(new Emitter<void>());
142
141
  public readonly onRequestSendFocus = this._onRequestSendFocus.event;
143
- private readonly _onRequestSyncScrollBar = this.register(new EventEmitter<void>());
142
+ private readonly _onRequestSyncScrollBar = this.register(new Emitter<void>());
144
143
  public readonly onRequestSyncScrollBar = this._onRequestSyncScrollBar.event;
145
- private readonly _onRequestWindowsOptionsReport = this.register(new EventEmitter<WindowsOptionsReportType>());
144
+ private readonly _onRequestWindowsOptionsReport = this.register(new Emitter<WindowsOptionsReportType>());
146
145
  public readonly onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event;
147
146
 
148
- private readonly _onA11yChar = this.register(new EventEmitter<string>());
147
+ private readonly _onA11yChar = this.register(new Emitter<string>());
149
148
  public readonly onA11yChar = this._onA11yChar.event;
150
- private readonly _onA11yTab = this.register(new EventEmitter<number>());
149
+ private readonly _onA11yTab = this.register(new Emitter<number>());
151
150
  public readonly onA11yTab = this._onA11yTab.event;
152
- private readonly _onCursorMove = this.register(new EventEmitter<void>());
151
+ private readonly _onCursorMove = this.register(new Emitter<void>());
153
152
  public readonly onCursorMove = this._onCursorMove.event;
154
- private readonly _onLineFeed = this.register(new EventEmitter<void>());
153
+ private readonly _onLineFeed = this.register(new Emitter<void>());
155
154
  public readonly onLineFeed = this._onLineFeed.event;
156
- private readonly _onScroll = this.register(new EventEmitter<number>());
155
+ private readonly _onScroll = this.register(new Emitter<number>());
157
156
  public readonly onScroll = this._onScroll.event;
158
- private readonly _onTitleChange = this.register(new EventEmitter<string>());
157
+ private readonly _onTitleChange = this.register(new Emitter<string>());
159
158
  public readonly onTitleChange = this._onTitleChange.event;
160
- private readonly _onColor = this.register(new EventEmitter<IColorEvent>());
159
+ private readonly _onColor = this.register(new Emitter<IColorEvent>());
161
160
  public readonly onColor = this._onColor.event;
162
161
 
163
162
  private _parseStack: IParseStack = {
@@ -500,7 +499,10 @@ export class InputHandler extends Disposable implements IInputHandler {
500
499
  const viewportEnd = this._dirtyRowTracker.end + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);
501
500
  const viewportStart = this._dirtyRowTracker.start + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);
502
501
  if (viewportStart < this._bufferService.rows) {
503
- this._onRequestRefreshRows.fire(Math.min(viewportStart, this._bufferService.rows - 1), Math.min(viewportEnd, this._bufferService.rows - 1));
502
+ this._onRequestRefreshRows.fire({
503
+ start: Math.min(viewportStart, this._bufferService.rows - 1),
504
+ end: Math.min(viewportEnd, this._bufferService.rows - 1)
505
+ });
504
506
  }
505
507
  }
506
508
 
@@ -1943,7 +1945,7 @@ export class InputHandler extends Disposable implements IInputHandler {
1943
1945
  case 1047: // alt screen buffer
1944
1946
  this._bufferService.buffers.activateAltBuffer(this._eraseAttrData());
1945
1947
  this._coreService.isCursorInitialized = true;
1946
- this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1);
1948
+ this._onRequestRefreshRows.fire(undefined);
1947
1949
  this._onRequestSyncScrollBar.fire();
1948
1950
  break;
1949
1951
  case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)
@@ -2171,7 +2173,7 @@ export class InputHandler extends Disposable implements IInputHandler {
2171
2173
  this.restoreCursor();
2172
2174
  }
2173
2175
  this._coreService.isCursorInitialized = true;
2174
- this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1);
2176
+ this._onRequestRefreshRows.fire(undefined);
2175
2177
  this._onRequestSyncScrollBar.fire();
2176
2178
  break;
2177
2179
  case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)
@@ -2972,14 +2974,18 @@ export class InputHandler extends Disposable implements IInputHandler {
2972
2974
  * feedback. Use `OSC 8 ; ; BEL` to finish the current hyperlink.
2973
2975
  */
2974
2976
  public setHyperlink(data: string): boolean {
2975
- const args = data.split(';');
2976
- if (args.length < 2) {
2977
- return false;
2977
+ // Arg parsing is special cases to support unencoded semi-colons in the URIs (#4944)
2978
+ const idx = data.indexOf(';');
2979
+ if (idx === -1) {
2980
+ // malformed sequence, just return as handled
2981
+ return true;
2978
2982
  }
2979
- if (args[1]) {
2980
- return this._createHyperlink(args[0], args[1]);
2983
+ const id = data.slice(0, idx).trim();
2984
+ const uri = data.slice(idx + 1);
2985
+ if (uri) {
2986
+ return this._createHyperlink(id, uri);
2981
2987
  }
2982
- if (args[0].trim()) {
2988
+ if (id.trim()) {
2983
2989
  return false;
2984
2990
  }
2985
2991
  return this._finishHyperlink();
@@ -3452,6 +3458,6 @@ class DirtyRowTracker implements IDirtyRowTracker {
3452
3458
  }
3453
3459
  }
3454
3460
 
3455
- function isValidColorIndex(value: number): value is ColorIndex {
3461
+ export function isValidColorIndex(value: number): value is ColorIndex {
3456
3462
  return 0 <= value && value < 256;
3457
3463
  }
@@ -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;
@@ -60,12 +60,6 @@ export interface IKeyboardEvent {
60
60
 
61
61
  export interface IScrollEvent {
62
62
  position: number;
63
- source: ScrollSource;
64
- }
65
-
66
- export const enum ScrollSource {
67
- TERMINAL,
68
- VIEWPORT,
69
63
  }
70
64
 
71
65
  export interface ICircularList<T> {
@@ -73,12 +67,12 @@ export interface ICircularList<T> {
73
67
  maxLength: number;
74
68
  isFull: boolean;
75
69
 
76
- onDeleteEmitter: IEventEmitter<IDeleteEvent>;
77
- onDelete: IEvent<IDeleteEvent>;
78
- onInsertEmitter: IEventEmitter<IInsertEvent>;
79
- onInsert: IEvent<IInsertEvent>;
80
- onTrimEmitter: IEventEmitter<number>;
81
- 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>;
82
76
 
83
77
  get(index: number): T | undefined;
84
78
  set(index: number, value: T): void;
@@ -264,7 +258,7 @@ export interface IMarker extends IDisposable {
264
258
  readonly id: number;
265
259
  readonly isDisposed: boolean;
266
260
  readonly line: number;
267
- onDispose: IEvent<void>;
261
+ onDispose: Event<void>;
268
262
  }
269
263
  export interface IModes {
270
264
  insertMode: boolean;
@@ -425,8 +419,8 @@ type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] exte
425
419
  : Enumerate<N, [...Acc, Acc['length']]>;
426
420
  type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
427
421
 
428
- type ColorIndex = IntRange<0, 256>; // number from 0 to 255
429
- type AllColorIndex = ColorIndex | SpecialColorIndex;
422
+ export type ColorIndex = IntRange<0, 256>; // number from 0 to 255
423
+ export type AllColorIndex = ColorIndex | SpecialColorIndex;
430
424
  export const enum SpecialColorIndex {
431
425
  FOREGROUND = 256,
432
426
  BACKGROUND = 257,
@@ -452,7 +446,7 @@ export type IColorEvent = (IColorReportRequest | IColorSetRequest | IColorRestor
452
446
  * Calls the parser and handles actions generated by the parser.
453
447
  */
454
448
  export interface IInputHandler {
455
- onTitleChange: IEvent<string>;
449
+ onTitleChange: Event<string>;
456
450
 
457
451
  parse(data: string | Uint8Array, promiseResult?: boolean): void | Promise<boolean>;
458
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) {
@@ -611,8 +615,8 @@ export class Buffer implements IBuffer {
611
615
  this._isClearing = true;
612
616
  for (let i = 0; i < this.markers.length; i++) {
613
617
  this.markers[i].dispose();
614
- this.markers.splice(i--, 1);
615
618
  }
619
+ this.markers.length = 0;
616
620
  this._isClearing = false;
617
621
  }
618
622
 
@@ -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
- import { IAttributeData, IBufferLine, ScrollSource } from 'common/Types';
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; }
@@ -125,7 +125,7 @@ export class BufferService extends Disposable implements IBufferService {
125
125
  * to avoid unwanted events being handled by the viewport when the event was triggered from the
126
126
  * viewport originally.
127
127
  */
128
- public scrollLines(disp: number, suppressScrollEvent?: boolean, source?: ScrollSource): void {
128
+ public scrollLines(disp: number, suppressScrollEvent?: boolean): void {
129
129
  const buffer = this.buffer;
130
130
  if (disp < 0) {
131
131
  if (buffer.ydisp === 0) {
@@ -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.
@@ -167,13 +167,15 @@ const DEFAULT_ENCODINGS: { [key: string]: CoreMouseEncoding } = {
167
167
  * To send a mouse event call `triggerMouseEvent`.
168
168
  */
169
169
  export class CoreMouseService extends Disposable implements ICoreMouseService {
170
+ public serviceBrand: any;
171
+
170
172
  private _protocols: { [name: string]: ICoreMouseProtocol } = {};
171
173
  private _encodings: { [name: string]: CoreMouseEncoding } = {};
172
174
  private _activeProtocol: string = '';
173
175
  private _activeEncoding: string = '';
174
176
  private _lastEvent: ICoreMouseEvent | null = null;
175
177
 
176
- private readonly _onProtocolChange = this.register(new EventEmitter<CoreMouseEventType>());
178
+ private readonly _onProtocolChange = this.register(new Emitter<CoreMouseEventType>());
177
179
  public readonly onProtocolChange = this._onProtocolChange.event;
178
180
 
179
181
  constructor(