@xterm/xterm 6.1.0-beta.28 → 6.1.0-beta.281

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 (181) 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 +56 -45
  8. package/src/browser/AccessibilityManager.ts +18 -13
  9. package/src/browser/Clipboard.ts +8 -5
  10. package/src/browser/ColorContrastCache.ts +3 -3
  11. package/src/browser/CoreBrowserTerminal.ts +179 -348
  12. package/src/browser/Dom.ts +178 -0
  13. package/src/browser/Linkifier.ts +14 -14
  14. package/src/browser/OscLinkProvider.ts +86 -18
  15. package/src/browser/RenderDebouncer.ts +7 -9
  16. package/src/browser/TimeBasedDebouncer.ts +12 -5
  17. package/src/browser/Types.ts +16 -14
  18. package/src/browser/Viewport.ts +58 -23
  19. package/src/browser/decorations/BufferDecorationRenderer.ts +3 -3
  20. package/src/browser/decorations/ColorZoneStore.ts +1 -1
  21. package/src/browser/decorations/OverviewRulerRenderer.ts +36 -20
  22. package/src/browser/input/CompositionHelper.ts +47 -11
  23. package/src/browser/input/Mouse.ts +5 -9
  24. package/src/browser/input/MoveToCell.ts +3 -3
  25. package/src/browser/public/Terminal.ts +33 -36
  26. package/src/browser/renderer/dom/DomRenderer.ts +265 -89
  27. package/src/browser/renderer/dom/DomRendererRowFactory.ts +34 -27
  28. package/src/browser/renderer/dom/WidthCache.ts +57 -55
  29. package/src/browser/renderer/shared/Constants.ts +7 -0
  30. package/src/browser/renderer/shared/RendererUtils.ts +1 -1
  31. package/src/browser/renderer/shared/SelectionRenderModel.ts +2 -2
  32. package/src/browser/renderer/shared/TextBlinkStateManager.ts +97 -0
  33. package/src/browser/renderer/shared/Types.ts +10 -4
  34. package/src/browser/scrollable/abstractScrollbar.ts +300 -0
  35. package/src/browser/scrollable/fastDomNode.ts +126 -0
  36. package/src/browser/scrollable/globalPointerMoveMonitor.ts +90 -0
  37. package/src/browser/scrollable/horizontalScrollbar.ts +85 -0
  38. package/src/browser/scrollable/mouseEvent.ts +292 -0
  39. package/src/browser/scrollable/scrollable.ts +486 -0
  40. package/src/browser/scrollable/scrollableElement.ts +581 -0
  41. package/src/browser/scrollable/scrollableElementOptions.ts +161 -0
  42. package/src/browser/scrollable/scrollbarArrow.ts +110 -0
  43. package/src/browser/scrollable/scrollbarState.ts +246 -0
  44. package/src/browser/scrollable/scrollbarVisibilityController.ts +113 -0
  45. package/src/browser/scrollable/touch.ts +485 -0
  46. package/src/browser/scrollable/verticalScrollbar.ts +143 -0
  47. package/src/browser/scrollable/widget.ts +23 -0
  48. package/src/browser/selection/SelectionModel.ts +1 -1
  49. package/src/browser/services/CharSizeService.ts +4 -4
  50. package/src/browser/services/CharacterJoinerService.ts +13 -11
  51. package/src/browser/services/CoreBrowserService.ts +7 -5
  52. package/src/browser/services/KeyboardService.ts +67 -0
  53. package/src/browser/services/LinkProviderService.ts +3 -3
  54. package/src/browser/services/MouseCoordsService.ts +47 -0
  55. package/src/browser/services/MouseService.ts +619 -23
  56. package/src/browser/services/RenderService.ts +33 -21
  57. package/src/browser/services/SelectionService.ts +72 -54
  58. package/src/browser/services/Services.ts +44 -21
  59. package/src/browser/services/ThemeService.ts +9 -9
  60. package/src/common/Async.ts +141 -0
  61. package/src/common/CircularList.ts +24 -3
  62. package/src/common/Color.ts +13 -5
  63. package/src/common/CoreTerminal.ts +61 -35
  64. package/src/common/Event.ts +118 -0
  65. package/src/common/InputHandler.ts +286 -105
  66. package/src/common/Lifecycle.ts +113 -0
  67. package/src/common/Platform.ts +15 -5
  68. package/src/common/SortedList.ts +8 -4
  69. package/src/common/StringBuilder.ts +67 -0
  70. package/src/common/TaskQueue.ts +17 -8
  71. package/src/common/Types.ts +68 -206
  72. package/src/common/Version.ts +1 -1
  73. package/src/common/WindowsMode.ts +2 -2
  74. package/src/common/buffer/AttributeData.ts +3 -2
  75. package/src/common/buffer/Buffer.ts +47 -32
  76. package/src/common/buffer/BufferLine.ts +175 -100
  77. package/src/common/buffer/BufferLineStringCache.ts +69 -0
  78. package/src/common/buffer/BufferReflow.ts +7 -4
  79. package/src/common/buffer/BufferSet.ts +13 -9
  80. package/src/common/buffer/CellData.ts +61 -4
  81. package/src/common/buffer/Constants.ts +13 -13
  82. package/src/common/buffer/Marker.ts +4 -4
  83. package/src/common/buffer/Types.ts +153 -3
  84. package/src/common/data/Charsets.ts +4 -7
  85. package/src/common/data/EscapeSequences.ts +71 -70
  86. package/src/common/input/Keyboard.ts +17 -10
  87. package/src/common/input/KittyKeyboard.ts +526 -0
  88. package/src/common/input/TextDecoder.ts +3 -3
  89. package/src/common/input/UnicodeV6.ts +3 -2
  90. package/src/common/input/Win32InputMode.ts +297 -0
  91. package/src/common/input/WriteBuffer.ts +108 -39
  92. package/src/common/input/XParseColor.ts +2 -2
  93. package/src/common/parser/ApcParser.ts +196 -0
  94. package/src/common/parser/Constants.ts +14 -4
  95. package/src/common/parser/DcsParser.ts +15 -16
  96. package/src/common/parser/EscapeSequenceParser.ts +214 -72
  97. package/src/common/parser/OscParser.ts +14 -15
  98. package/src/common/parser/Params.ts +31 -12
  99. package/src/common/parser/Types.ts +40 -30
  100. package/src/common/public/BufferApiView.ts +3 -3
  101. package/src/common/public/BufferLineApiView.ts +4 -4
  102. package/src/common/public/BufferNamespaceApi.ts +5 -5
  103. package/src/common/public/ParserApi.ts +5 -2
  104. package/src/common/public/UnicodeApi.ts +1 -1
  105. package/src/common/services/BufferService.ts +17 -13
  106. package/src/common/services/CharsetService.ts +6 -2
  107. package/src/common/services/CoreService.ts +23 -10
  108. package/src/common/services/DecorationService.ts +260 -15
  109. package/src/common/services/InstantiationService.ts +2 -2
  110. package/src/common/services/LogService.ts +2 -32
  111. package/src/common/services/{CoreMouseService.ts → MouseStateService.ts} +22 -133
  112. package/src/common/services/OptionsService.ts +17 -7
  113. package/src/common/services/OscLinkService.ts +3 -2
  114. package/src/common/services/ServiceRegistry.ts +14 -8
  115. package/src/common/services/Services.ts +54 -50
  116. package/src/common/services/UnicodeService.ts +6 -11
  117. package/typings/xterm.d.ts +329 -34
  118. package/src/common/Clone.ts +0 -23
  119. package/src/common/TypedArrayUtils.ts +0 -17
  120. package/src/vs/base/browser/browser.ts +0 -141
  121. package/src/vs/base/browser/canIUse.ts +0 -49
  122. package/src/vs/base/browser/dom.ts +0 -2369
  123. package/src/vs/base/browser/fastDomNode.ts +0 -316
  124. package/src/vs/base/browser/globalPointerMoveMonitor.ts +0 -112
  125. package/src/vs/base/browser/iframe.ts +0 -135
  126. package/src/vs/base/browser/keyboardEvent.ts +0 -213
  127. package/src/vs/base/browser/mouseEvent.ts +0 -229
  128. package/src/vs/base/browser/touch.ts +0 -372
  129. package/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +0 -303
  130. package/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +0 -114
  131. package/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +0 -720
  132. package/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +0 -165
  133. package/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +0 -114
  134. package/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +0 -243
  135. package/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts +0 -118
  136. package/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +0 -116
  137. package/src/vs/base/browser/ui/widget.ts +0 -57
  138. package/src/vs/base/browser/window.ts +0 -14
  139. package/src/vs/base/common/arrays.ts +0 -887
  140. package/src/vs/base/common/arraysFind.ts +0 -202
  141. package/src/vs/base/common/assert.ts +0 -71
  142. package/src/vs/base/common/async.ts +0 -1992
  143. package/src/vs/base/common/cancellation.ts +0 -148
  144. package/src/vs/base/common/charCode.ts +0 -450
  145. package/src/vs/base/common/collections.ts +0 -140
  146. package/src/vs/base/common/decorators.ts +0 -130
  147. package/src/vs/base/common/equals.ts +0 -146
  148. package/src/vs/base/common/errors.ts +0 -303
  149. package/src/vs/base/common/event.ts +0 -1778
  150. package/src/vs/base/common/functional.ts +0 -32
  151. package/src/vs/base/common/hash.ts +0 -316
  152. package/src/vs/base/common/iterator.ts +0 -159
  153. package/src/vs/base/common/keyCodes.ts +0 -526
  154. package/src/vs/base/common/keybindings.ts +0 -284
  155. package/src/vs/base/common/lazy.ts +0 -47
  156. package/src/vs/base/common/lifecycle.ts +0 -801
  157. package/src/vs/base/common/linkedList.ts +0 -142
  158. package/src/vs/base/common/map.ts +0 -202
  159. package/src/vs/base/common/numbers.ts +0 -98
  160. package/src/vs/base/common/observable.ts +0 -76
  161. package/src/vs/base/common/observableInternal/api.ts +0 -31
  162. package/src/vs/base/common/observableInternal/autorun.ts +0 -281
  163. package/src/vs/base/common/observableInternal/base.ts +0 -489
  164. package/src/vs/base/common/observableInternal/debugName.ts +0 -145
  165. package/src/vs/base/common/observableInternal/derived.ts +0 -428
  166. package/src/vs/base/common/observableInternal/lazyObservableValue.ts +0 -146
  167. package/src/vs/base/common/observableInternal/logging.ts +0 -328
  168. package/src/vs/base/common/observableInternal/promise.ts +0 -209
  169. package/src/vs/base/common/observableInternal/utils.ts +0 -610
  170. package/src/vs/base/common/platform.ts +0 -281
  171. package/src/vs/base/common/scrollable.ts +0 -522
  172. package/src/vs/base/common/sequence.ts +0 -34
  173. package/src/vs/base/common/stopwatch.ts +0 -43
  174. package/src/vs/base/common/strings.ts +0 -557
  175. package/src/vs/base/common/symbols.ts +0 -9
  176. package/src/vs/base/common/uint.ts +0 -59
  177. package/src/vs/patches/nls.ts +0 -90
  178. package/src/vs/typings/base-common.d.ts +0 -20
  179. package/src/vs/typings/require.d.ts +0 -42
  180. package/src/vs/typings/vscode-globals-nls.d.ts +0 -36
  181. 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
- }