@xterm/xterm 6.1.0-beta.22 → 6.1.0-beta.220

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 (160) hide show
  1. package/README.md +62 -38
  2. package/css/xterm.css +29 -22
  3. package/lib/xterm.js +1 -1
  4. package/lib/xterm.js.map +1 -1
  5. package/lib/xterm.mjs +8 -34
  6. package/lib/xterm.mjs.map +4 -4
  7. package/package.json +25 -22
  8. package/src/browser/AccessibilityManager.ts +11 -6
  9. package/src/browser/Clipboard.ts +6 -3
  10. package/src/browser/CoreBrowserTerminal.ts +147 -318
  11. package/src/browser/Dom.ts +178 -0
  12. package/src/browser/Linkifier.ts +11 -11
  13. package/src/browser/OscLinkProvider.ts +3 -1
  14. package/src/browser/RenderDebouncer.ts +2 -2
  15. package/src/browser/TimeBasedDebouncer.ts +2 -2
  16. package/src/browser/Types.ts +12 -11
  17. package/src/browser/Viewport.ts +55 -20
  18. package/src/browser/decorations/BufferDecorationRenderer.ts +1 -1
  19. package/src/browser/decorations/OverviewRulerRenderer.ts +33 -17
  20. package/src/browser/input/CompositionHelper.ts +44 -8
  21. package/src/browser/public/Terminal.ts +25 -28
  22. package/src/browser/renderer/dom/DomRenderer.ts +242 -76
  23. package/src/browser/renderer/dom/DomRendererRowFactory.ts +19 -13
  24. package/src/browser/renderer/dom/WidthCache.ts +54 -52
  25. package/src/browser/renderer/shared/Constants.ts +7 -0
  26. package/src/browser/renderer/shared/TextBlinkStateManager.ts +97 -0
  27. package/src/browser/renderer/shared/Types.ts +8 -2
  28. package/src/browser/scrollable/abstractScrollbar.ts +300 -0
  29. package/src/browser/scrollable/fastDomNode.ts +126 -0
  30. package/src/browser/scrollable/globalPointerMoveMonitor.ts +90 -0
  31. package/src/browser/scrollable/horizontalScrollbar.ts +85 -0
  32. package/src/browser/scrollable/mouseEvent.ts +292 -0
  33. package/src/browser/scrollable/scrollable.ts +486 -0
  34. package/src/browser/scrollable/scrollableElement.ts +581 -0
  35. package/src/browser/scrollable/scrollableElementOptions.ts +161 -0
  36. package/src/browser/scrollable/scrollbarArrow.ts +110 -0
  37. package/src/browser/scrollable/scrollbarState.ts +246 -0
  38. package/src/browser/scrollable/scrollbarVisibilityController.ts +113 -0
  39. package/src/browser/scrollable/touch.ts +485 -0
  40. package/src/browser/scrollable/verticalScrollbar.ts +143 -0
  41. package/src/browser/scrollable/widget.ts +23 -0
  42. package/src/browser/services/CharSizeService.ts +2 -2
  43. package/src/browser/services/CoreBrowserService.ts +7 -5
  44. package/src/browser/services/KeyboardService.ts +67 -0
  45. package/src/browser/services/LinkProviderService.ts +1 -1
  46. package/src/browser/services/MouseCoordsService.ts +47 -0
  47. package/src/browser/services/MouseService.ts +518 -25
  48. package/src/browser/services/RenderService.ts +22 -15
  49. package/src/browser/services/SelectionService.ts +42 -35
  50. package/src/browser/services/Services.ts +40 -17
  51. package/src/browser/services/ThemeService.ts +2 -2
  52. package/src/common/Async.ts +105 -0
  53. package/src/common/CircularList.ts +2 -2
  54. package/src/common/Color.ts +8 -0
  55. package/src/common/CoreTerminal.ts +31 -21
  56. package/src/common/Event.ts +118 -0
  57. package/src/common/InputHandler.ts +283 -81
  58. package/src/common/Lifecycle.ts +113 -0
  59. package/src/common/Platform.ts +13 -3
  60. package/src/common/SortedList.ts +7 -3
  61. package/src/common/TaskQueue.ts +14 -5
  62. package/src/common/Types.ts +35 -15
  63. package/src/common/Version.ts +9 -0
  64. package/src/common/buffer/Buffer.ts +34 -19
  65. package/src/common/buffer/BufferLine.ts +133 -65
  66. package/src/common/buffer/BufferLineStringCache.ts +69 -0
  67. package/src/common/buffer/BufferSet.ts +11 -6
  68. package/src/common/buffer/CellData.ts +57 -0
  69. package/src/common/buffer/Marker.ts +2 -2
  70. package/src/common/buffer/Types.ts +6 -2
  71. package/src/common/data/EscapeSequences.ts +71 -70
  72. package/src/common/input/Keyboard.ts +14 -7
  73. package/src/common/input/KittyKeyboard.ts +526 -0
  74. package/src/common/input/Win32InputMode.ts +297 -0
  75. package/src/common/input/WriteBuffer.ts +64 -32
  76. package/src/common/input/XParseColor.ts +2 -2
  77. package/src/common/parser/ApcParser.ts +197 -0
  78. package/src/common/parser/Constants.ts +14 -4
  79. package/src/common/parser/DcsParser.ts +5 -5
  80. package/src/common/parser/EscapeSequenceParser.ts +205 -63
  81. package/src/common/parser/OscParser.ts +5 -5
  82. package/src/common/parser/Params.ts +27 -8
  83. package/src/common/parser/Types.ts +36 -2
  84. package/src/common/public/BufferLineApiView.ts +2 -2
  85. package/src/common/public/BufferNamespaceApi.ts +2 -2
  86. package/src/common/public/ParserApi.ts +3 -0
  87. package/src/common/services/BufferService.ts +14 -9
  88. package/src/common/services/CharsetService.ts +4 -0
  89. package/src/common/services/CoreService.ts +18 -4
  90. package/src/common/services/DecorationService.ts +24 -8
  91. package/src/common/services/LogService.ts +1 -31
  92. package/src/common/services/{CoreMouseService.ts → MouseStateService.ts} +21 -132
  93. package/src/common/services/OptionsService.ts +13 -4
  94. package/src/common/services/ServiceRegistry.ts +9 -7
  95. package/src/common/services/Services.ts +47 -40
  96. package/src/common/services/UnicodeService.ts +1 -1
  97. package/typings/xterm.d.ts +318 -34
  98. package/src/common/TypedArrayUtils.ts +0 -17
  99. package/src/vs/base/browser/browser.ts +0 -141
  100. package/src/vs/base/browser/canIUse.ts +0 -49
  101. package/src/vs/base/browser/dom.ts +0 -2369
  102. package/src/vs/base/browser/fastDomNode.ts +0 -316
  103. package/src/vs/base/browser/globalPointerMoveMonitor.ts +0 -112
  104. package/src/vs/base/browser/iframe.ts +0 -135
  105. package/src/vs/base/browser/keyboardEvent.ts +0 -213
  106. package/src/vs/base/browser/mouseEvent.ts +0 -229
  107. package/src/vs/base/browser/touch.ts +0 -372
  108. package/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +0 -303
  109. package/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +0 -114
  110. package/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +0 -720
  111. package/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +0 -165
  112. package/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +0 -114
  113. package/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +0 -243
  114. package/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts +0 -118
  115. package/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +0 -116
  116. package/src/vs/base/browser/ui/widget.ts +0 -57
  117. package/src/vs/base/browser/window.ts +0 -14
  118. package/src/vs/base/common/arrays.ts +0 -887
  119. package/src/vs/base/common/arraysFind.ts +0 -202
  120. package/src/vs/base/common/assert.ts +0 -71
  121. package/src/vs/base/common/async.ts +0 -1992
  122. package/src/vs/base/common/cancellation.ts +0 -148
  123. package/src/vs/base/common/charCode.ts +0 -450
  124. package/src/vs/base/common/collections.ts +0 -140
  125. package/src/vs/base/common/decorators.ts +0 -130
  126. package/src/vs/base/common/equals.ts +0 -146
  127. package/src/vs/base/common/errors.ts +0 -303
  128. package/src/vs/base/common/event.ts +0 -1778
  129. package/src/vs/base/common/functional.ts +0 -32
  130. package/src/vs/base/common/hash.ts +0 -316
  131. package/src/vs/base/common/iterator.ts +0 -159
  132. package/src/vs/base/common/keyCodes.ts +0 -526
  133. package/src/vs/base/common/keybindings.ts +0 -284
  134. package/src/vs/base/common/lazy.ts +0 -47
  135. package/src/vs/base/common/lifecycle.ts +0 -801
  136. package/src/vs/base/common/linkedList.ts +0 -142
  137. package/src/vs/base/common/map.ts +0 -202
  138. package/src/vs/base/common/numbers.ts +0 -98
  139. package/src/vs/base/common/observable.ts +0 -76
  140. package/src/vs/base/common/observableInternal/api.ts +0 -31
  141. package/src/vs/base/common/observableInternal/autorun.ts +0 -281
  142. package/src/vs/base/common/observableInternal/base.ts +0 -489
  143. package/src/vs/base/common/observableInternal/debugName.ts +0 -145
  144. package/src/vs/base/common/observableInternal/derived.ts +0 -428
  145. package/src/vs/base/common/observableInternal/lazyObservableValue.ts +0 -146
  146. package/src/vs/base/common/observableInternal/logging.ts +0 -328
  147. package/src/vs/base/common/observableInternal/promise.ts +0 -209
  148. package/src/vs/base/common/observableInternal/utils.ts +0 -610
  149. package/src/vs/base/common/platform.ts +0 -281
  150. package/src/vs/base/common/scrollable.ts +0 -522
  151. package/src/vs/base/common/sequence.ts +0 -34
  152. package/src/vs/base/common/stopwatch.ts +0 -43
  153. package/src/vs/base/common/strings.ts +0 -557
  154. package/src/vs/base/common/symbols.ts +0 -9
  155. package/src/vs/base/common/uint.ts +0 -59
  156. package/src/vs/patches/nls.ts +0 -90
  157. package/src/vs/typings/base-common.d.ts +0 -20
  158. package/src/vs/typings/require.d.ts +0 -42
  159. package/src/vs/typings/vscode-globals-nls.d.ts +0 -36
  160. package/src/vs/typings/vscode-globals-product.d.ts +0 -33
@@ -1,202 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
-
6
- import { Comparator } from './arrays';
7
-
8
- export function findLast<T>(array: readonly T[], predicate: (item: T) => boolean): T | undefined {
9
- const idx = findLastIdx(array, predicate);
10
- if (idx === -1) {
11
- return undefined;
12
- }
13
- return array[idx];
14
- }
15
-
16
- export function findLastIdx<T>(array: readonly T[], predicate: (item: T) => boolean, fromIndex = array.length - 1): number {
17
- for (let i = fromIndex; i >= 0; i--) {
18
- const element = array[i];
19
-
20
- if (predicate(element)) {
21
- return i;
22
- }
23
- }
24
-
25
- return -1;
26
- }
27
-
28
- /**
29
- * Finds the last item where predicate is true using binary search.
30
- * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!
31
- *
32
- * @returns `undefined` if no item matches, otherwise the last item that matches the predicate.
33
- */
34
- export function findLastMonotonous<T>(array: readonly T[], predicate: (item: T) => boolean): T | undefined {
35
- const idx = findLastIdxMonotonous(array, predicate);
36
- return idx === -1 ? undefined : array[idx];
37
- }
38
-
39
- /**
40
- * Finds the last item where predicate is true using binary search.
41
- * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!
42
- *
43
- * @returns `startIdx - 1` if predicate is false for all items, otherwise the index of the last item that matches the predicate.
44
- */
45
- export function findLastIdxMonotonous<T>(array: readonly T[], predicate: (item: T) => boolean, startIdx = 0, endIdxEx = array.length): number {
46
- let i = startIdx;
47
- let j = endIdxEx;
48
- while (i < j) {
49
- const k = Math.floor((i + j) / 2);
50
- if (predicate(array[k])) {
51
- i = k + 1;
52
- } else {
53
- j = k;
54
- }
55
- }
56
- return i - 1;
57
- }
58
-
59
- /**
60
- * Finds the first item where predicate is true using binary search.
61
- * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[false, ..., false, true, ..., true]`!
62
- *
63
- * @returns `undefined` if no item matches, otherwise the first item that matches the predicate.
64
- */
65
- export function findFirstMonotonous<T>(array: readonly T[], predicate: (item: T) => boolean): T | undefined {
66
- const idx = findFirstIdxMonotonousOrArrLen(array, predicate);
67
- return idx === array.length ? undefined : array[idx];
68
- }
69
-
70
- /**
71
- * Finds the first item where predicate is true using binary search.
72
- * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[false, ..., false, true, ..., true]`!
73
- *
74
- * @returns `endIdxEx` if predicate is false for all items, otherwise the index of the first item that matches the predicate.
75
- */
76
- export function findFirstIdxMonotonousOrArrLen<T>(array: readonly T[], predicate: (item: T) => boolean, startIdx = 0, endIdxEx = array.length): number {
77
- let i = startIdx;
78
- let j = endIdxEx;
79
- while (i < j) {
80
- const k = Math.floor((i + j) / 2);
81
- if (predicate(array[k])) {
82
- j = k;
83
- } else {
84
- i = k + 1;
85
- }
86
- }
87
- return i;
88
- }
89
-
90
- export function findFirstIdxMonotonous<T>(array: readonly T[], predicate: (item: T) => boolean, startIdx = 0, endIdxEx = array.length): number {
91
- const idx = findFirstIdxMonotonousOrArrLen(array, predicate, startIdx, endIdxEx);
92
- return idx === array.length ? -1 : idx;
93
- }
94
-
95
- /**
96
- * Use this when
97
- * * You have a sorted array
98
- * * You query this array with a monotonous predicate to find the last item that has a certain property.
99
- * * You query this array multiple times with monotonous predicates that get weaker and weaker.
100
- */
101
- export class MonotonousArray<T> {
102
- public static assertInvariants = false;
103
-
104
- private _findLastMonotonousLastIdx = 0;
105
- private _prevFindLastPredicate: ((item: T) => boolean) | undefined;
106
-
107
- constructor(private readonly _array: readonly T[]) {
108
- }
109
-
110
- /**
111
- * The predicate must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!
112
- * For subsequent calls, current predicate must be weaker than (or equal to) the previous predicate, i.e. more entries must be `true`.
113
- */
114
- findLastMonotonous(predicate: (item: T) => boolean): T | undefined {
115
- if (MonotonousArray.assertInvariants) {
116
- if (this._prevFindLastPredicate) {
117
- for (const item of this._array) {
118
- if (this._prevFindLastPredicate(item) && !predicate(item)) {
119
- throw new Error('MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.');
120
- }
121
- }
122
- }
123
- this._prevFindLastPredicate = predicate;
124
- }
125
-
126
- const idx = findLastIdxMonotonous(this._array, predicate, this._findLastMonotonousLastIdx);
127
- this._findLastMonotonousLastIdx = idx + 1;
128
- return idx === -1 ? undefined : this._array[idx];
129
- }
130
- }
131
-
132
- /**
133
- * Returns the first item that is equal to or greater than every other item.
134
- */
135
- export function findFirstMax<T>(array: readonly T[], comparator: Comparator<T>): T | undefined {
136
- if (array.length === 0) {
137
- return undefined;
138
- }
139
-
140
- let max = array[0];
141
- for (let i = 1; i < array.length; i++) {
142
- const item = array[i];
143
- if (comparator(item, max) > 0) {
144
- max = item;
145
- }
146
- }
147
- return max;
148
- }
149
-
150
- /**
151
- * Returns the last item that is equal to or greater than every other item.
152
- */
153
- export function findLastMax<T>(array: readonly T[], comparator: Comparator<T>): T | undefined {
154
- if (array.length === 0) {
155
- return undefined;
156
- }
157
-
158
- let max = array[0];
159
- for (let i = 1; i < array.length; i++) {
160
- const item = array[i];
161
- if (comparator(item, max) >= 0) {
162
- max = item;
163
- }
164
- }
165
- return max;
166
- }
167
-
168
- /**
169
- * Returns the first item that is equal to or less than every other item.
170
- */
171
- export function findFirstMin<T>(array: readonly T[], comparator: Comparator<T>): T | undefined {
172
- return findFirstMax(array, (a, b) => -comparator(a, b));
173
- }
174
-
175
- export function findMaxIdx<T>(array: readonly T[], comparator: Comparator<T>): number {
176
- if (array.length === 0) {
177
- return -1;
178
- }
179
-
180
- let maxIdx = 0;
181
- for (let i = 1; i < array.length; i++) {
182
- const item = array[i];
183
- if (comparator(item, array[maxIdx]) > 0) {
184
- maxIdx = i;
185
- }
186
- }
187
- return maxIdx;
188
- }
189
-
190
- /**
191
- * Returns the first mapped value of the array which is not undefined.
192
- */
193
- export function mapFindFirst<T, R>(items: Iterable<T>, mapFn: (value: T) => R | undefined): R | undefined {
194
- for (const value of items) {
195
- const mapped = mapFn(value);
196
- if (mapped !== undefined) {
197
- return mapped;
198
- }
199
- }
200
-
201
- return undefined;
202
- }
@@ -1,71 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
-
6
- import { BugIndicatingError, onUnexpectedError } from 'vs/base/common/errors';
7
-
8
- /**
9
- * Throws an error with the provided message if the provided value does not evaluate to a true Javascript value.
10
- *
11
- * @deprecated Use `assert(...)` instead.
12
- * This method is usually used like this:
13
- * ```ts
14
- * import * as assert from 'vs/base/common/assert';
15
- * assert.ok(...);
16
- * ```
17
- *
18
- * However, `assert` in that example is a user chosen name.
19
- * There is no tooling for generating such an import statement.
20
- * Thus, the `assert(...)` function should be used instead.
21
- */
22
- export function ok(value?: unknown, message?: string) {
23
- if (!value) {
24
- throw new Error(message ? `Assertion failed (${message})` : 'Assertion Failed');
25
- }
26
- }
27
-
28
- export function assertNever(value: never, message = 'Unreachable'): never {
29
- throw new Error(message);
30
- }
31
-
32
- export function assert(condition: boolean, message = 'unexpected state'): asserts condition {
33
- if (!condition) {
34
- throw new BugIndicatingError(`Assertion Failed: ${message}`);
35
- }
36
- }
37
-
38
- /**
39
- * Like assert, but doesn't throw.
40
- */
41
- export function softAssert(condition: boolean): void {
42
- if (!condition) {
43
- onUnexpectedError(new BugIndicatingError('Soft Assertion Failed'));
44
- }
45
- }
46
-
47
- /**
48
- * condition must be side-effect free!
49
- */
50
- export function assertFn(condition: () => boolean): void {
51
- if (!condition()) {
52
- // eslint-disable-next-line no-debugger
53
- debugger;
54
- // Reevaluate `condition` again to make debugging easier
55
- condition();
56
- onUnexpectedError(new BugIndicatingError('Assertion Failed'));
57
- }
58
- }
59
-
60
- export function checkAdjacentItems<T>(items: readonly T[], predicate: (item1: T, item2: T) => boolean): boolean {
61
- let i = 0;
62
- while (i < items.length - 1) {
63
- const a = items[i];
64
- const b = items[i + 1];
65
- if (!predicate(a, b)) {
66
- return false;
67
- }
68
- i++;
69
- }
70
- return true;
71
- }