@xterm/xterm 6.1.0-beta.2 → 6.1.0-beta.200
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.
- package/README.md +60 -38
- package/css/xterm.css +29 -22
- package/lib/xterm.js +1 -1
- package/lib/xterm.js.map +1 -1
- package/lib/xterm.mjs +8 -34
- package/lib/xterm.mjs.map +4 -4
- package/package.json +36 -24
- package/src/browser/AccessibilityManager.ts +6 -3
- package/src/browser/Clipboard.ts +6 -3
- package/src/browser/CoreBrowserTerminal.ts +147 -318
- package/src/browser/Dom.ts +178 -0
- package/src/browser/Linkifier.ts +11 -11
- package/src/browser/OscLinkProvider.ts +4 -2
- package/src/browser/RenderDebouncer.ts +2 -2
- package/src/browser/TimeBasedDebouncer.ts +2 -2
- package/src/browser/Types.ts +12 -11
- package/src/browser/Viewport.ts +55 -20
- package/src/browser/decorations/BufferDecorationRenderer.ts +1 -1
- package/src/browser/decorations/OverviewRulerRenderer.ts +33 -17
- package/src/browser/input/CompositionHelper.ts +44 -8
- package/src/browser/public/Terminal.ts +25 -28
- package/src/browser/renderer/dom/DomRenderer.ts +205 -41
- package/src/browser/renderer/dom/DomRendererRowFactory.ts +19 -13
- package/src/browser/renderer/dom/WidthCache.ts +54 -52
- package/src/browser/renderer/shared/Constants.ts +7 -0
- package/src/browser/renderer/shared/TextBlinkStateManager.ts +97 -0
- package/src/browser/renderer/shared/Types.ts +8 -2
- package/src/browser/scrollable/abstractScrollbar.ts +300 -0
- package/src/browser/scrollable/fastDomNode.ts +126 -0
- package/src/browser/scrollable/globalPointerMoveMonitor.ts +90 -0
- package/src/browser/scrollable/horizontalScrollbar.ts +85 -0
- package/src/browser/scrollable/mouseEvent.ts +292 -0
- package/src/browser/scrollable/scrollable.ts +486 -0
- package/src/browser/scrollable/scrollableElement.ts +579 -0
- package/src/browser/scrollable/scrollableElementOptions.ts +161 -0
- package/src/browser/scrollable/scrollbarArrow.ts +110 -0
- package/src/browser/scrollable/scrollbarState.ts +246 -0
- package/src/browser/scrollable/scrollbarVisibilityController.ts +113 -0
- package/src/browser/scrollable/touch.ts +485 -0
- package/src/browser/scrollable/verticalScrollbar.ts +143 -0
- package/src/browser/scrollable/widget.ts +23 -0
- package/src/browser/services/CharSizeService.ts +2 -2
- package/src/browser/services/CoreBrowserService.ts +7 -5
- package/src/browser/services/KeyboardService.ts +67 -0
- package/src/browser/services/LinkProviderService.ts +1 -1
- package/src/browser/services/MouseCoordsService.ts +47 -0
- package/src/browser/services/MouseService.ts +518 -25
- package/src/browser/services/RenderService.ts +22 -16
- package/src/browser/services/SelectionService.ts +16 -8
- package/src/browser/services/Services.ts +40 -17
- package/src/browser/services/ThemeService.ts +2 -2
- package/src/common/Async.ts +105 -0
- package/src/common/CircularList.ts +2 -2
- package/src/common/Color.ts +8 -0
- package/src/common/CoreTerminal.ts +29 -21
- package/src/common/Event.ts +118 -0
- package/src/common/InputHandler.ts +256 -36
- package/src/common/Lifecycle.ts +113 -0
- package/src/common/Platform.ts +13 -3
- package/src/common/SortedList.ts +7 -3
- package/src/common/TaskQueue.ts +14 -5
- package/src/common/Types.ts +36 -16
- package/src/common/Version.ts +9 -0
- package/src/common/buffer/Buffer.ts +22 -16
- package/src/common/buffer/BufferLine.ts +4 -5
- package/src/common/buffer/BufferSet.ts +7 -6
- package/src/common/buffer/CellData.ts +57 -0
- package/src/common/buffer/Marker.ts +2 -2
- package/src/common/buffer/Types.ts +6 -2
- package/src/common/data/Charsets.ts +1 -1
- package/src/common/data/EscapeSequences.ts +71 -70
- package/src/common/input/Keyboard.ts +14 -7
- package/src/common/input/KittyKeyboard.ts +519 -0
- package/src/common/input/Win32InputMode.ts +297 -0
- package/src/common/input/WriteBuffer.ts +34 -2
- package/src/common/input/XParseColor.ts +2 -2
- package/src/common/parser/ApcParser.ts +245 -0
- package/src/common/parser/Constants.ts +22 -4
- package/src/common/parser/DcsParser.ts +5 -5
- package/src/common/parser/EscapeSequenceParser.ts +155 -43
- package/src/common/parser/OscParser.ts +5 -5
- package/src/common/parser/Types.ts +34 -1
- package/src/common/public/BufferLineApiView.ts +2 -2
- package/src/common/public/BufferNamespaceApi.ts +2 -2
- package/src/common/public/ParserApi.ts +3 -0
- package/src/common/services/BufferService.ts +8 -5
- package/src/common/services/CharsetService.ts +4 -0
- package/src/common/services/CoreService.ts +18 -4
- package/src/common/services/DecorationService.ts +24 -8
- package/src/common/services/LogService.ts +1 -31
- package/src/common/services/{CoreMouseService.ts → MouseStateService.ts} +21 -132
- package/src/common/services/OptionsService.ts +13 -7
- package/src/common/services/Services.ts +47 -44
- package/src/common/services/UnicodeService.ts +1 -1
- package/typings/xterm.d.ts +320 -45
- package/src/common/TypedArrayUtils.ts +0 -17
- package/src/vs/base/browser/browser.ts +0 -141
- package/src/vs/base/browser/canIUse.ts +0 -49
- package/src/vs/base/browser/dom.ts +0 -2369
- package/src/vs/base/browser/fastDomNode.ts +0 -316
- package/src/vs/base/browser/globalPointerMoveMonitor.ts +0 -112
- package/src/vs/base/browser/iframe.ts +0 -135
- package/src/vs/base/browser/keyboardEvent.ts +0 -213
- package/src/vs/base/browser/mouseEvent.ts +0 -229
- package/src/vs/base/browser/touch.ts +0 -372
- package/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +0 -303
- package/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +0 -114
- package/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +0 -720
- package/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +0 -165
- package/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +0 -114
- package/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +0 -243
- package/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts +0 -118
- package/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +0 -116
- package/src/vs/base/browser/ui/widget.ts +0 -57
- package/src/vs/base/browser/window.ts +0 -14
- package/src/vs/base/common/arrays.ts +0 -887
- package/src/vs/base/common/arraysFind.ts +0 -202
- package/src/vs/base/common/assert.ts +0 -71
- package/src/vs/base/common/async.ts +0 -1992
- package/src/vs/base/common/cancellation.ts +0 -148
- package/src/vs/base/common/charCode.ts +0 -450
- package/src/vs/base/common/collections.ts +0 -140
- package/src/vs/base/common/decorators.ts +0 -130
- package/src/vs/base/common/equals.ts +0 -146
- package/src/vs/base/common/errors.ts +0 -303
- package/src/vs/base/common/event.ts +0 -1778
- package/src/vs/base/common/functional.ts +0 -32
- package/src/vs/base/common/hash.ts +0 -316
- package/src/vs/base/common/iterator.ts +0 -159
- package/src/vs/base/common/keyCodes.ts +0 -526
- package/src/vs/base/common/keybindings.ts +0 -284
- package/src/vs/base/common/lazy.ts +0 -47
- package/src/vs/base/common/lifecycle.ts +0 -801
- package/src/vs/base/common/linkedList.ts +0 -142
- package/src/vs/base/common/map.ts +0 -202
- package/src/vs/base/common/numbers.ts +0 -98
- package/src/vs/base/common/observable.ts +0 -76
- package/src/vs/base/common/observableInternal/api.ts +0 -31
- package/src/vs/base/common/observableInternal/autorun.ts +0 -281
- package/src/vs/base/common/observableInternal/base.ts +0 -489
- package/src/vs/base/common/observableInternal/debugName.ts +0 -145
- package/src/vs/base/common/observableInternal/derived.ts +0 -428
- package/src/vs/base/common/observableInternal/lazyObservableValue.ts +0 -146
- package/src/vs/base/common/observableInternal/logging.ts +0 -328
- package/src/vs/base/common/observableInternal/promise.ts +0 -209
- package/src/vs/base/common/observableInternal/utils.ts +0 -610
- package/src/vs/base/common/platform.ts +0 -281
- package/src/vs/base/common/scrollable.ts +0 -522
- package/src/vs/base/common/sequence.ts +0 -34
- package/src/vs/base/common/stopwatch.ts +0 -43
- package/src/vs/base/common/strings.ts +0 -557
- package/src/vs/base/common/symbols.ts +0 -9
- package/src/vs/base/common/uint.ts +0 -59
- package/src/vs/patches/nls.ts +0 -90
- package/src/vs/typings/base-common.d.ts +0 -20
- package/src/vs/typings/require.d.ts +0 -42
- package/src/vs/typings/vscode-globals-nls.d.ts +0 -36
- package/src/vs/typings/vscode-globals-product.d.ts +0 -33
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Disposable } from '
|
|
6
|
+
import { Disposable } from 'common/Lifecycle';
|
|
7
7
|
import { ILogService, IOptionsService, LogLevelEnum } from 'common/services/Services';
|
|
8
8
|
|
|
9
9
|
type LogType = (message?: any, ...optionalParams: any[]) => void;
|
|
@@ -43,9 +43,6 @@ export class LogService extends Disposable implements ILogService {
|
|
|
43
43
|
super();
|
|
44
44
|
this._updateLogLevel();
|
|
45
45
|
this._register(this._optionsService.onSpecificOptionChange('logLevel', () => this._updateLogLevel()));
|
|
46
|
-
|
|
47
|
-
// For trace logging, assume the latest created log service is valid
|
|
48
|
-
traceLogger = this;
|
|
49
46
|
}
|
|
50
47
|
|
|
51
48
|
private _updateLogLevel(): void {
|
|
@@ -95,30 +92,3 @@ export class LogService extends Disposable implements ILogService {
|
|
|
95
92
|
}
|
|
96
93
|
}
|
|
97
94
|
}
|
|
98
|
-
|
|
99
|
-
let traceLogger: ILogService;
|
|
100
|
-
export function setTraceLogger(logger: ILogService): void {
|
|
101
|
-
traceLogger = logger;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* A decorator that can be used to automatically log trace calls to the decorated function.
|
|
106
|
-
*/
|
|
107
|
-
export function traceCall(_target: any, key: string, descriptor: any): any {
|
|
108
|
-
if (typeof descriptor.value !== 'function') {
|
|
109
|
-
throw new Error('not supported');
|
|
110
|
-
}
|
|
111
|
-
const fnKey = 'value';
|
|
112
|
-
const fn = descriptor.value;
|
|
113
|
-
descriptor[fnKey] = function (...args: any[]) {
|
|
114
|
-
// Early exit
|
|
115
|
-
if (traceLogger.logLevel !== LogLevelEnum.TRACE) {
|
|
116
|
-
return fn.apply(this, args);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
traceLogger.trace(`GlyphRenderer#${fn.name}(${args.map(e => JSON.stringify(e)).join(', ')})`);
|
|
120
|
-
const result = fn.apply(this, args);
|
|
121
|
-
traceLogger.trace(`GlyphRenderer#${fn.name} return`, result);
|
|
122
|
-
return result;
|
|
123
|
-
};
|
|
124
|
-
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { IMouseStateService } from 'common/services/Services';
|
|
6
6
|
import { ICoreMouseProtocol, ICoreMouseEvent, CoreMouseEncoding, CoreMouseEventType, CoreMouseButton, CoreMouseAction } from 'common/Types';
|
|
7
|
-
import { Disposable } from '
|
|
8
|
-
import { Emitter } from '
|
|
7
|
+
import { Disposable } from 'common/Lifecycle';
|
|
8
|
+
import { Emitter } from 'common/Event';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Supported default protocols.
|
|
@@ -151,7 +151,7 @@ const DEFAULT_ENCODINGS: { [key: string]: CoreMouseEncoding } = {
|
|
|
151
151
|
};
|
|
152
152
|
|
|
153
153
|
/**
|
|
154
|
-
*
|
|
154
|
+
* MouseStateService
|
|
155
155
|
*
|
|
156
156
|
* Provides mouse tracking reports with different protocols and encodings.
|
|
157
157
|
* - protocols: NONE (default), X10, VT200, DRAG, ANY
|
|
@@ -166,25 +166,21 @@ const DEFAULT_ENCODINGS: { [key: string]: CoreMouseEncoding } = {
|
|
|
166
166
|
* a tracking report to the backend based on protocol and encoding limitations.
|
|
167
167
|
* To send a mouse event call `triggerMouseEvent`.
|
|
168
168
|
*/
|
|
169
|
-
export class
|
|
169
|
+
export class MouseStateService extends Disposable implements IMouseStateService {
|
|
170
170
|
public serviceBrand: any;
|
|
171
171
|
|
|
172
172
|
private _protocols: { [name: string]: ICoreMouseProtocol } = {};
|
|
173
173
|
private _encodings: { [name: string]: CoreMouseEncoding } = {};
|
|
174
174
|
private _activeProtocol: string = '';
|
|
175
175
|
private _activeEncoding: string = '';
|
|
176
|
-
private
|
|
177
|
-
private _wheelPartialScroll: number = 0;
|
|
176
|
+
private _customWheelEventHandler: ((event: WheelEvent) => boolean) | undefined;
|
|
178
177
|
|
|
179
178
|
private readonly _onProtocolChange = this._register(new Emitter<CoreMouseEventType>());
|
|
180
179
|
public readonly onProtocolChange = this._onProtocolChange.event;
|
|
181
180
|
|
|
182
|
-
constructor(
|
|
183
|
-
@IBufferService private readonly _bufferService: IBufferService,
|
|
184
|
-
@ICoreService private readonly _coreService: ICoreService,
|
|
185
|
-
@IOptionsService private readonly _optionsService: IOptionsService
|
|
186
|
-
) {
|
|
181
|
+
constructor() {
|
|
187
182
|
super();
|
|
183
|
+
|
|
188
184
|
// register default protocols and encodings
|
|
189
185
|
for (const name of Object.keys(DEFAULT_PROTOCOLS)) this.addProtocol(name, DEFAULT_PROTOCOLS[name]);
|
|
190
186
|
for (const name of Object.keys(DEFAULT_ENCODINGS)) this.addEncoding(name, DEFAULT_ENCODINGS[name]);
|
|
@@ -230,136 +226,29 @@ export class CoreMouseService extends Disposable implements ICoreMouseService {
|
|
|
230
226
|
public reset(): void {
|
|
231
227
|
this.activeProtocol = 'NONE';
|
|
232
228
|
this.activeEncoding = 'DEFAULT';
|
|
233
|
-
this._lastEvent = null;
|
|
234
|
-
this._wheelPartialScroll = 0;
|
|
235
229
|
}
|
|
236
230
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
* This prevents hyper-sensitive scrolling in alt buffer.
|
|
240
|
-
*/
|
|
241
|
-
public consumeWheelEvent(ev: WheelEvent, cellHeight?: number, dpr?: number): number {
|
|
242
|
-
// Do nothing if it's not a vertical scroll event
|
|
243
|
-
if (ev.deltaY === 0 || ev.shiftKey) {
|
|
244
|
-
return 0;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
if (cellHeight === undefined || dpr === undefined) {
|
|
248
|
-
return 0;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
const targetWheelEventPixels = cellHeight / dpr;
|
|
252
|
-
let amount = this._applyScrollModifier(ev.deltaY, ev);
|
|
253
|
-
|
|
254
|
-
if (ev.deltaMode === WheelEvent.DOM_DELTA_PIXEL) {
|
|
255
|
-
amount /= (targetWheelEventPixels + 0.0); // Prevent integer division
|
|
256
|
-
|
|
257
|
-
const isLikelyTrackpad = Math.abs(ev.deltaY) < 50;
|
|
258
|
-
if (isLikelyTrackpad) {
|
|
259
|
-
amount *= 0.3;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
this._wheelPartialScroll += amount;
|
|
263
|
-
amount = Math.floor(Math.abs(this._wheelPartialScroll)) * (this._wheelPartialScroll > 0 ? 1 : -1);
|
|
264
|
-
this._wheelPartialScroll %= 1;
|
|
265
|
-
} else if (ev.deltaMode === WheelEvent.DOM_DELTA_PAGE) {
|
|
266
|
-
amount *= this._bufferService.rows;
|
|
267
|
-
}
|
|
268
|
-
return amount;
|
|
231
|
+
public setCustomWheelEventHandler(customWheelEventHandler: ((event: WheelEvent) => boolean) | undefined): void {
|
|
232
|
+
this._customWheelEventHandler = customWheelEventHandler;
|
|
269
233
|
}
|
|
270
234
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
if (ev.altKey || ev.ctrlKey || ev.shiftKey) {
|
|
274
|
-
return amount * this._optionsService.rawOptions.fastScrollSensitivity * this._optionsService.rawOptions.scrollSensitivity;
|
|
275
|
-
}
|
|
276
|
-
return amount * this._optionsService.rawOptions.scrollSensitivity;
|
|
235
|
+
public allowCustomWheelEvent(ev: WheelEvent): boolean {
|
|
236
|
+
return this._customWheelEventHandler ? this._customWheelEventHandler(ev) !== false : true;
|
|
277
237
|
}
|
|
278
238
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
* Returns true if the event passed all protocol restrictions and a report
|
|
283
|
-
* was sent, otherwise false. The return value may be used to decide whether
|
|
284
|
-
* the default event action in the bowser component should be omitted.
|
|
285
|
-
*
|
|
286
|
-
* Note: The method will change values of the given event object
|
|
287
|
-
* to fullfill protocol and encoding restrictions.
|
|
288
|
-
*/
|
|
289
|
-
public triggerMouseEvent(e: ICoreMouseEvent): boolean {
|
|
290
|
-
// range check for col/row
|
|
291
|
-
if (e.col < 0 || e.col >= this._bufferService.cols
|
|
292
|
-
|| e.row < 0 || e.row >= this._bufferService.rows) {
|
|
293
|
-
return false;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
// filter nonsense combinations of button + action
|
|
297
|
-
if (e.button === CoreMouseButton.WHEEL && e.action === CoreMouseAction.MOVE) {
|
|
298
|
-
return false;
|
|
299
|
-
}
|
|
300
|
-
if (e.button === CoreMouseButton.NONE && e.action !== CoreMouseAction.MOVE) {
|
|
301
|
-
return false;
|
|
302
|
-
}
|
|
303
|
-
if (e.button !== CoreMouseButton.WHEEL && (e.action === CoreMouseAction.LEFT || e.action === CoreMouseAction.RIGHT)) {
|
|
304
|
-
return false;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
// report 1-based coords
|
|
308
|
-
e.col++;
|
|
309
|
-
e.row++;
|
|
310
|
-
|
|
311
|
-
// debounce move events at grid or pixel level
|
|
312
|
-
if (e.action === CoreMouseAction.MOVE
|
|
313
|
-
&& this._lastEvent
|
|
314
|
-
&& this._equalEvents(this._lastEvent, e, this._activeEncoding === 'SGR_PIXELS')
|
|
315
|
-
) {
|
|
316
|
-
return false;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
// apply protocol restrictions
|
|
320
|
-
if (!this._protocols[this._activeProtocol].restrict(e)) {
|
|
321
|
-
return false;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// encode report and send
|
|
325
|
-
const report = this._encodings[this._activeEncoding](e);
|
|
326
|
-
if (report) {
|
|
327
|
-
// always send DEFAULT as binary data
|
|
328
|
-
if (this._activeEncoding === 'DEFAULT') {
|
|
329
|
-
this._coreService.triggerBinaryEvent(report);
|
|
330
|
-
} else {
|
|
331
|
-
this._coreService.triggerDataEvent(report, true);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
this._lastEvent = e;
|
|
239
|
+
public restrictMouseEvent(e: ICoreMouseEvent): boolean {
|
|
240
|
+
return this._protocols[this._activeProtocol].restrict(e);
|
|
241
|
+
}
|
|
336
242
|
|
|
337
|
-
|
|
243
|
+
public encodeMouseEvent(e: ICoreMouseEvent): string {
|
|
244
|
+
return this._encodings[this._activeEncoding](e);
|
|
338
245
|
}
|
|
339
246
|
|
|
340
|
-
public
|
|
341
|
-
return
|
|
342
|
-
down: !!(events & CoreMouseEventType.DOWN),
|
|
343
|
-
up: !!(events & CoreMouseEventType.UP),
|
|
344
|
-
drag: !!(events & CoreMouseEventType.DRAG),
|
|
345
|
-
move: !!(events & CoreMouseEventType.MOVE),
|
|
346
|
-
wheel: !!(events & CoreMouseEventType.WHEEL)
|
|
347
|
-
};
|
|
247
|
+
public get isDefaultEncoding(): boolean {
|
|
248
|
+
return this._activeEncoding === 'DEFAULT';
|
|
348
249
|
}
|
|
349
250
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
if (e1.x !== e2.x) return false;
|
|
353
|
-
if (e1.y !== e2.y) return false;
|
|
354
|
-
} else {
|
|
355
|
-
if (e1.col !== e2.col) return false;
|
|
356
|
-
if (e1.row !== e2.row) return false;
|
|
357
|
-
}
|
|
358
|
-
if (e1.button !== e2.button) return false;
|
|
359
|
-
if (e1.action !== e2.action) return false;
|
|
360
|
-
if (e1.ctrl !== e2.ctrl) return false;
|
|
361
|
-
if (e1.alt !== e2.alt) return false;
|
|
362
|
-
if (e1.shift !== e2.shift) return false;
|
|
363
|
-
return true;
|
|
251
|
+
public get isPixelEncoding(): boolean {
|
|
252
|
+
return this._activeEncoding === 'SGR_PIXELS';
|
|
364
253
|
}
|
|
365
254
|
}
|
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Disposable, toDisposable } from '
|
|
6
|
+
import { Disposable, toDisposable } from 'common/Lifecycle';
|
|
7
7
|
import { isMac } from 'common/Platform';
|
|
8
8
|
import { CursorStyle, IDisposable } from 'common/Types';
|
|
9
9
|
import { FontWeight, IOptionsService, ITerminalOptions } from 'common/services/Services';
|
|
10
|
-
import { Emitter } from '
|
|
10
|
+
import { Emitter } from 'common/Event';
|
|
11
11
|
|
|
12
12
|
export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
|
|
13
13
|
cols: 80,
|
|
14
14
|
rows: 24,
|
|
15
|
+
showCursorImmediately: false,
|
|
15
16
|
cursorBlink: false,
|
|
17
|
+
blinkIntervalDuration: 0,
|
|
16
18
|
cursorStyle: 'block',
|
|
17
19
|
cursorWidth: 1,
|
|
18
20
|
cursorInactiveStyle: 'outline',
|
|
19
|
-
customGlyphs: true,
|
|
20
21
|
drawBoldTextInBrightColors: true,
|
|
21
22
|
documentOverride: null,
|
|
22
|
-
fastScrollModifier: 'alt',
|
|
23
23
|
fastScrollSensitivity: 5,
|
|
24
24
|
fontFamily: 'monospace',
|
|
25
25
|
fontSize: 15,
|
|
@@ -32,6 +32,7 @@ export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
|
|
|
32
32
|
logLevel: 'info',
|
|
33
33
|
logger: null,
|
|
34
34
|
scrollback: 1000,
|
|
35
|
+
scrollbar: { showScrollbar: true },
|
|
35
36
|
scrollOnEraseInDisplay: false,
|
|
36
37
|
scrollOnUserInput: true,
|
|
37
38
|
scrollSensitivity: 1,
|
|
@@ -49,14 +50,13 @@ export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
|
|
|
49
50
|
rescaleOverlappingGlyphs: false,
|
|
50
51
|
rightClickSelectsWord: isMac,
|
|
51
52
|
windowOptions: {},
|
|
52
|
-
windowsMode: false,
|
|
53
53
|
windowsPty: {},
|
|
54
54
|
wordSeparator: ' ()[]{}\',"`',
|
|
55
55
|
altClickMovesCursor: true,
|
|
56
56
|
convertEol: false,
|
|
57
57
|
termName: 'xterm',
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
quirks: {},
|
|
59
|
+
vtExtensions: {}
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
const FONT_WEIGHT_OPTIONS: Extract<FontWeight, string>[] = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];
|
|
@@ -169,6 +169,12 @@ export class OptionsService extends Disposable implements IOptionsService {
|
|
|
169
169
|
}
|
|
170
170
|
value = FONT_WEIGHT_OPTIONS.includes(value) ? value : DEFAULT_OPTIONS[key];
|
|
171
171
|
break;
|
|
172
|
+
case 'blinkIntervalDuration':
|
|
173
|
+
value = Math.floor(value);
|
|
174
|
+
if (value < 0) {
|
|
175
|
+
throw new Error(`${key} cannot be less than 0, value: ${value}`);
|
|
176
|
+
}
|
|
177
|
+
break;
|
|
172
178
|
case 'cursorWidth':
|
|
173
179
|
value = Math.floor(value);
|
|
174
180
|
// Fall through for bounds check
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty,
|
|
7
|
-
import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IModes, IOscLinkData, IWindowOptions } from 'common/Types';
|
|
6
|
+
import type { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty, IOverviewRulerOptions } from '@xterm/xterm';
|
|
7
|
+
import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IKittyKeyboardState, IModes, IOscLinkData, IWindowOptions } from 'common/Types';
|
|
8
8
|
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
|
9
9
|
import { createDecorator } from 'common/services/ServiceRegistry';
|
|
10
|
-
import type { Emitter,
|
|
10
|
+
import type { Emitter, IEvent } from '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:
|
|
22
|
-
onScroll:
|
|
21
|
+
onResize: IEvent<IBufferResizeEvent>;
|
|
22
|
+
onScroll: IEvent<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;
|
|
@@ -33,8 +33,8 @@ export interface IBufferResizeEvent {
|
|
|
33
33
|
rowsChanged: boolean;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export const
|
|
37
|
-
export interface
|
|
36
|
+
export const IMouseStateService = createDecorator<IMouseStateService>('MouseStateService');
|
|
37
|
+
export interface IMouseStateService {
|
|
38
38
|
serviceBrand: undefined;
|
|
39
39
|
|
|
40
40
|
activeProtocol: string;
|
|
@@ -43,33 +43,17 @@ export interface ICoreMouseService {
|
|
|
43
43
|
addProtocol(name: string, protocol: ICoreMouseProtocol): void;
|
|
44
44
|
addEncoding(name: string, encoding: CoreMouseEncoding): void;
|
|
45
45
|
reset(): void;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
* Triggers a mouse event to be sent.
|
|
49
|
-
*
|
|
50
|
-
* Returns true if the event passed all protocol restrictions and a report
|
|
51
|
-
* was sent, otherwise false. The return value may be used to decide whether
|
|
52
|
-
* the default event action in the bowser component should be omitted.
|
|
53
|
-
*
|
|
54
|
-
* Note: The method will change values of the given event object
|
|
55
|
-
* to fullfill protocol and encoding restrictions.
|
|
56
|
-
*/
|
|
57
|
-
triggerMouseEvent(event: ICoreMouseEvent): boolean;
|
|
46
|
+
setCustomWheelEventHandler(customWheelEventHandler: ((event: WheelEvent) => boolean) | undefined): void;
|
|
47
|
+
allowCustomWheelEvent(ev: WheelEvent): boolean;
|
|
58
48
|
|
|
59
49
|
/**
|
|
60
50
|
* Event to announce changes in mouse tracking.
|
|
61
51
|
*/
|
|
62
|
-
onProtocolChange:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
explainEvents(events: CoreMouseEventType): { [event: string]: boolean };
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Process wheel event taking partial scroll into account.
|
|
71
|
-
*/
|
|
72
|
-
consumeWheelEvent(ev: WheelEvent, cellHeight?: number, dpr?: number): number;
|
|
52
|
+
onProtocolChange: IEvent<CoreMouseEventType>;
|
|
53
|
+
restrictMouseEvent(event: ICoreMouseEvent): boolean;
|
|
54
|
+
encodeMouseEvent(event: ICoreMouseEvent): string;
|
|
55
|
+
readonly isDefaultEncoding: boolean;
|
|
56
|
+
readonly isPixelEncoding: boolean;
|
|
73
57
|
}
|
|
74
58
|
|
|
75
59
|
export const ICoreService = createDecorator<ICoreService>('CoreService');
|
|
@@ -85,11 +69,12 @@ export interface ICoreService {
|
|
|
85
69
|
|
|
86
70
|
readonly modes: IModes;
|
|
87
71
|
readonly decPrivateModes: IDecPrivateModes;
|
|
72
|
+
readonly kittyKeyboard: IKittyKeyboardState;
|
|
88
73
|
|
|
89
|
-
readonly onData:
|
|
90
|
-
readonly onUserInput:
|
|
91
|
-
readonly onBinary:
|
|
92
|
-
readonly onRequestScrollToBottom:
|
|
74
|
+
readonly onData: IEvent<string>;
|
|
75
|
+
readonly onUserInput: IEvent<void>;
|
|
76
|
+
readonly onBinary: IEvent<string>;
|
|
77
|
+
readonly onRequestScrollToBottom: IEvent<void>;
|
|
93
78
|
|
|
94
79
|
reset(): void;
|
|
95
80
|
|
|
@@ -116,6 +101,7 @@ export interface ICharsetService {
|
|
|
116
101
|
|
|
117
102
|
charset: ICharset | undefined;
|
|
118
103
|
readonly glevel: number;
|
|
104
|
+
readonly charsets: (ICharset | undefined)[];
|
|
119
105
|
|
|
120
106
|
reset(): void;
|
|
121
107
|
|
|
@@ -199,7 +185,7 @@ export interface IOptionsService {
|
|
|
199
185
|
/**
|
|
200
186
|
* Adds an event listener for when any option changes.
|
|
201
187
|
*/
|
|
202
|
-
readonly onOptionChange:
|
|
188
|
+
readonly onOptionChange: IEvent<keyof ITerminalOptions>;
|
|
203
189
|
|
|
204
190
|
/**
|
|
205
191
|
* Adds an event listener for when a specific option changes, this is a convenience method that is
|
|
@@ -227,15 +213,13 @@ export interface ITerminalOptions {
|
|
|
227
213
|
cols?: number;
|
|
228
214
|
convertEol?: boolean;
|
|
229
215
|
cursorBlink?: boolean;
|
|
216
|
+
blinkIntervalDuration?: number;
|
|
230
217
|
cursorStyle?: CursorStyle;
|
|
231
218
|
cursorWidth?: number;
|
|
232
219
|
cursorInactiveStyle?: CursorInactiveStyle;
|
|
233
|
-
customGlyphs?: boolean;
|
|
234
220
|
disableStdin?: boolean;
|
|
235
221
|
documentOverride?: any | null;
|
|
236
222
|
drawBoldTextInBrightColors?: boolean;
|
|
237
|
-
/** @deprecated No longer supported */
|
|
238
|
-
fastScrollModifier?: 'none' | 'alt' | 'ctrl' | 'shift';
|
|
239
223
|
fastScrollSensitivity?: number;
|
|
240
224
|
fontSize?: number;
|
|
241
225
|
fontFamily?: string;
|
|
@@ -254,6 +238,7 @@ export interface ITerminalOptions {
|
|
|
254
238
|
rescaleOverlappingGlyphs?: boolean;
|
|
255
239
|
rightClickSelectsWord?: boolean;
|
|
256
240
|
rows?: number;
|
|
241
|
+
showCursorImmediately?: boolean;
|
|
257
242
|
screenReaderMode?: boolean;
|
|
258
243
|
scrollback?: number;
|
|
259
244
|
scrollOnUserInput?: boolean;
|
|
@@ -261,15 +246,15 @@ export interface ITerminalOptions {
|
|
|
261
246
|
smoothScrollDuration?: number;
|
|
262
247
|
tabStopWidth?: number;
|
|
263
248
|
theme?: ITheme;
|
|
264
|
-
windowsMode?: boolean;
|
|
265
249
|
windowsPty?: IWindowsPty;
|
|
266
250
|
windowOptions?: IWindowOptions;
|
|
267
251
|
wordSeparator?: string;
|
|
268
|
-
|
|
252
|
+
quirks?: ITerminalQuirks;
|
|
253
|
+
scrollbar?: IScrollbarOptions;
|
|
269
254
|
scrollOnEraseInDisplay?: boolean;
|
|
255
|
+
vtExtensions?: IVtExtensions;
|
|
270
256
|
|
|
271
257
|
[key: string]: any;
|
|
272
|
-
cancelEvents: boolean;
|
|
273
258
|
termName: string;
|
|
274
259
|
}
|
|
275
260
|
|
|
@@ -304,6 +289,24 @@ export interface ITheme {
|
|
|
304
289
|
extendedAnsi?: string[];
|
|
305
290
|
}
|
|
306
291
|
|
|
292
|
+
export interface ITerminalQuirks {
|
|
293
|
+
allowSetCursorBlink?: boolean;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export interface IScrollbarOptions {
|
|
297
|
+
showScrollbar?: boolean;
|
|
298
|
+
showArrows?: boolean;
|
|
299
|
+
width?: number;
|
|
300
|
+
overviewRuler?: IOverviewRulerOptions;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export interface IVtExtensions {
|
|
304
|
+
kittyKeyboard?: boolean;
|
|
305
|
+
kittySgrBoldFaintControl?: boolean;
|
|
306
|
+
win32InputMode?: boolean;
|
|
307
|
+
colorSchemeQuery?: boolean;
|
|
308
|
+
}
|
|
309
|
+
|
|
307
310
|
export const IOscLinkService = createDecorator<IOscLinkService>('OscLinkService');
|
|
308
311
|
export interface IOscLinkService {
|
|
309
312
|
serviceBrand: undefined;
|
|
@@ -353,7 +356,7 @@ export interface IUnicodeService {
|
|
|
353
356
|
/** Currently active version. */
|
|
354
357
|
activeVersion: string;
|
|
355
358
|
/** Event triggered, when activate version changed. */
|
|
356
|
-
readonly onChange:
|
|
359
|
+
readonly onChange: IEvent<string>;
|
|
357
360
|
|
|
358
361
|
/**
|
|
359
362
|
* Unicode version dependent
|
|
@@ -378,8 +381,8 @@ export const IDecorationService = createDecorator<IDecorationService>('Decoratio
|
|
|
378
381
|
export interface IDecorationService extends IDisposable {
|
|
379
382
|
serviceBrand: undefined;
|
|
380
383
|
readonly decorations: IterableIterator<IInternalDecoration>;
|
|
381
|
-
readonly onDecorationRegistered:
|
|
382
|
-
readonly onDecorationRemoved:
|
|
384
|
+
readonly onDecorationRegistered: IEvent<IInternalDecoration>;
|
|
385
|
+
readonly onDecorationRemoved: IEvent<IInternalDecoration>;
|
|
383
386
|
registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;
|
|
384
387
|
reset(): void;
|
|
385
388
|
/**
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { UnicodeV6 } from 'common/input/UnicodeV6';
|
|
7
7
|
import { IUnicodeService, IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';
|
|
8
|
-
import { Emitter } from '
|
|
8
|
+
import { Emitter } from 'common/Event';
|
|
9
9
|
|
|
10
10
|
export class UnicodeService implements IUnicodeService {
|
|
11
11
|
public serviceBrand: any;
|