@xterm/xterm 5.4.0-beta.1

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 (108) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +235 -0
  3. package/css/xterm.css +209 -0
  4. package/lib/xterm.js +2 -0
  5. package/lib/xterm.js.map +1 -0
  6. package/package.json +101 -0
  7. package/src/browser/AccessibilityManager.ts +278 -0
  8. package/src/browser/Clipboard.ts +93 -0
  9. package/src/browser/ColorContrastCache.ts +34 -0
  10. package/src/browser/Lifecycle.ts +33 -0
  11. package/src/browser/Linkifier2.ts +416 -0
  12. package/src/browser/LocalizableStrings.ts +12 -0
  13. package/src/browser/OscLinkProvider.ts +128 -0
  14. package/src/browser/RenderDebouncer.ts +83 -0
  15. package/src/browser/Terminal.ts +1317 -0
  16. package/src/browser/TimeBasedDebouncer.ts +86 -0
  17. package/src/browser/Types.d.ts +181 -0
  18. package/src/browser/Viewport.ts +401 -0
  19. package/src/browser/decorations/BufferDecorationRenderer.ts +134 -0
  20. package/src/browser/decorations/ColorZoneStore.ts +117 -0
  21. package/src/browser/decorations/OverviewRulerRenderer.ts +218 -0
  22. package/src/browser/input/CompositionHelper.ts +246 -0
  23. package/src/browser/input/Mouse.ts +54 -0
  24. package/src/browser/input/MoveToCell.ts +249 -0
  25. package/src/browser/public/Terminal.ts +260 -0
  26. package/src/browser/renderer/dom/DomRenderer.ts +509 -0
  27. package/src/browser/renderer/dom/DomRendererRowFactory.ts +526 -0
  28. package/src/browser/renderer/dom/WidthCache.ts +160 -0
  29. package/src/browser/renderer/shared/CellColorResolver.ts +137 -0
  30. package/src/browser/renderer/shared/CharAtlasCache.ts +96 -0
  31. package/src/browser/renderer/shared/CharAtlasUtils.ts +75 -0
  32. package/src/browser/renderer/shared/Constants.ts +14 -0
  33. package/src/browser/renderer/shared/CursorBlinkStateManager.ts +146 -0
  34. package/src/browser/renderer/shared/CustomGlyphs.ts +687 -0
  35. package/src/browser/renderer/shared/DevicePixelObserver.ts +41 -0
  36. package/src/browser/renderer/shared/README.md +1 -0
  37. package/src/browser/renderer/shared/RendererUtils.ts +58 -0
  38. package/src/browser/renderer/shared/SelectionRenderModel.ts +91 -0
  39. package/src/browser/renderer/shared/TextureAtlas.ts +1082 -0
  40. package/src/browser/renderer/shared/Types.d.ts +173 -0
  41. package/src/browser/selection/SelectionModel.ts +144 -0
  42. package/src/browser/selection/Types.d.ts +15 -0
  43. package/src/browser/services/CharSizeService.ts +102 -0
  44. package/src/browser/services/CharacterJoinerService.ts +339 -0
  45. package/src/browser/services/CoreBrowserService.ts +137 -0
  46. package/src/browser/services/MouseService.ts +46 -0
  47. package/src/browser/services/RenderService.ts +279 -0
  48. package/src/browser/services/SelectionService.ts +1031 -0
  49. package/src/browser/services/Services.ts +147 -0
  50. package/src/browser/services/ThemeService.ts +237 -0
  51. package/src/common/CircularList.ts +241 -0
  52. package/src/common/Clone.ts +23 -0
  53. package/src/common/Color.ts +357 -0
  54. package/src/common/CoreTerminal.ts +284 -0
  55. package/src/common/EventEmitter.ts +78 -0
  56. package/src/common/InputHandler.ts +3461 -0
  57. package/src/common/Lifecycle.ts +108 -0
  58. package/src/common/MultiKeyMap.ts +42 -0
  59. package/src/common/Platform.ts +44 -0
  60. package/src/common/SortedList.ts +118 -0
  61. package/src/common/TaskQueue.ts +166 -0
  62. package/src/common/TypedArrayUtils.ts +17 -0
  63. package/src/common/Types.d.ts +553 -0
  64. package/src/common/WindowsMode.ts +27 -0
  65. package/src/common/buffer/AttributeData.ts +196 -0
  66. package/src/common/buffer/Buffer.ts +654 -0
  67. package/src/common/buffer/BufferLine.ts +524 -0
  68. package/src/common/buffer/BufferRange.ts +13 -0
  69. package/src/common/buffer/BufferReflow.ts +223 -0
  70. package/src/common/buffer/BufferSet.ts +134 -0
  71. package/src/common/buffer/CellData.ts +94 -0
  72. package/src/common/buffer/Constants.ts +149 -0
  73. package/src/common/buffer/Marker.ts +43 -0
  74. package/src/common/buffer/Types.d.ts +52 -0
  75. package/src/common/data/Charsets.ts +256 -0
  76. package/src/common/data/EscapeSequences.ts +153 -0
  77. package/src/common/input/Keyboard.ts +398 -0
  78. package/src/common/input/TextDecoder.ts +346 -0
  79. package/src/common/input/UnicodeV6.ts +145 -0
  80. package/src/common/input/WriteBuffer.ts +246 -0
  81. package/src/common/input/XParseColor.ts +80 -0
  82. package/src/common/parser/Constants.ts +58 -0
  83. package/src/common/parser/DcsParser.ts +192 -0
  84. package/src/common/parser/EscapeSequenceParser.ts +792 -0
  85. package/src/common/parser/OscParser.ts +238 -0
  86. package/src/common/parser/Params.ts +229 -0
  87. package/src/common/parser/Types.d.ts +275 -0
  88. package/src/common/public/AddonManager.ts +53 -0
  89. package/src/common/public/BufferApiView.ts +35 -0
  90. package/src/common/public/BufferLineApiView.ts +29 -0
  91. package/src/common/public/BufferNamespaceApi.ts +36 -0
  92. package/src/common/public/ParserApi.ts +37 -0
  93. package/src/common/public/UnicodeApi.ts +27 -0
  94. package/src/common/services/BufferService.ts +151 -0
  95. package/src/common/services/CharsetService.ts +34 -0
  96. package/src/common/services/CoreMouseService.ts +318 -0
  97. package/src/common/services/CoreService.ts +87 -0
  98. package/src/common/services/DecorationService.ts +140 -0
  99. package/src/common/services/InstantiationService.ts +85 -0
  100. package/src/common/services/LogService.ts +124 -0
  101. package/src/common/services/OptionsService.ts +202 -0
  102. package/src/common/services/OscLinkService.ts +115 -0
  103. package/src/common/services/ServiceRegistry.ts +49 -0
  104. package/src/common/services/Services.ts +373 -0
  105. package/src/common/services/UnicodeService.ts +111 -0
  106. package/src/headless/Terminal.ts +136 -0
  107. package/src/headless/public/Terminal.ts +195 -0
  108. package/typings/xterm.d.ts +1857 -0
@@ -0,0 +1,553 @@
1
+ /**
2
+ * Copyright (c) 2018 The xterm.js authors. All rights reserved.
3
+ * @license MIT
4
+ */
5
+
6
+ import { IDeleteEvent, IInsertEvent } from 'common/CircularList';
7
+ import { IEvent, IEventEmitter } from 'common/EventEmitter';
8
+ import { Attributes, UnderlineStyle } from 'common/buffer/Constants'; // eslint-disable-line no-unused-vars
9
+ import { IBufferSet } from 'common/buffer/Types';
10
+ import { IParams } from 'common/parser/Types';
11
+ import { ICoreMouseService, ICoreService, IOptionsService, IUnicodeService } from 'common/services/Services';
12
+ import { IFunctionIdentifier, ITerminalOptions as IPublicTerminalOptions } from '@xterm/xterm';
13
+
14
+ export interface ICoreTerminal {
15
+ coreMouseService: ICoreMouseService;
16
+ coreService: ICoreService;
17
+ optionsService: IOptionsService;
18
+ unicodeService: IUnicodeService;
19
+ buffers: IBufferSet;
20
+ options: Required<ITerminalOptions>;
21
+ registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise<boolean>): IDisposable;
22
+ registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise<boolean>): IDisposable;
23
+ registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise<boolean>): IDisposable;
24
+ registerOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
25
+ }
26
+
27
+ export interface IDisposable {
28
+ dispose(): void;
29
+ }
30
+
31
+ // TODO: The options that are not in the public API should be reviewed
32
+ export interface ITerminalOptions extends IPublicTerminalOptions {
33
+ [key: string]: any;
34
+ cancelEvents?: boolean;
35
+ convertEol?: boolean;
36
+ termName?: string;
37
+ }
38
+
39
+ export type CursorStyle = 'block' | 'underline' | 'bar';
40
+
41
+ export type CursorInactiveStyle = 'outline' | 'block' | 'bar' | 'underline' | 'none';
42
+
43
+ export type XtermListener = (...args: any[]) => void;
44
+
45
+ /**
46
+ * A keyboard event interface which does not depend on the DOM, KeyboardEvent implicitly extends
47
+ * this event.
48
+ */
49
+ export interface IKeyboardEvent {
50
+ altKey: boolean;
51
+ ctrlKey: boolean;
52
+ shiftKey: boolean;
53
+ metaKey: boolean;
54
+ /** @deprecated See KeyboardEvent.keyCode */
55
+ keyCode: number;
56
+ key: string;
57
+ type: string;
58
+ code: string;
59
+ }
60
+
61
+ export interface IScrollEvent {
62
+ position: number;
63
+ source: ScrollSource;
64
+ }
65
+
66
+ export const enum ScrollSource {
67
+ TERMINAL,
68
+ VIEWPORT,
69
+ }
70
+
71
+ export interface ICircularList<T> {
72
+ length: number;
73
+ maxLength: number;
74
+ isFull: boolean;
75
+
76
+ onDeleteEmitter: IEventEmitter<IDeleteEvent>;
77
+ onDelete: IEvent<IDeleteEvent>;
78
+ onInsertEmitter: IEventEmitter<IInsertEvent>;
79
+ onInsert: IEvent<IInsertEvent>;
80
+ onTrimEmitter: IEventEmitter<number>;
81
+ onTrim: IEvent<number>;
82
+
83
+ get(index: number): T | undefined;
84
+ set(index: number, value: T): void;
85
+ push(value: T): void;
86
+ recycle(): T;
87
+ pop(): T | undefined;
88
+ splice(start: number, deleteCount: number, ...items: T[]): void;
89
+ trimStart(count: number): void;
90
+ shiftElements(start: number, count: number, offset: number): void;
91
+ }
92
+
93
+ export const enum KeyboardResultType {
94
+ SEND_KEY,
95
+ SELECT_ALL,
96
+ PAGE_UP,
97
+ PAGE_DOWN
98
+ }
99
+
100
+ export interface IKeyboardResult {
101
+ type: KeyboardResultType;
102
+ cancel: boolean;
103
+ key: string | undefined;
104
+ }
105
+
106
+ export interface ICharset {
107
+ [key: string]: string | undefined;
108
+ }
109
+
110
+ export type CharData = [number, string, number, number];
111
+
112
+ export interface IColor {
113
+ css: string;
114
+ rgba: number; // 32-bit int with rgba in each byte
115
+ }
116
+ export type IColorRGB = [number, number, number];
117
+
118
+ export interface IExtendedAttrs {
119
+ ext: number;
120
+ underlineStyle: UnderlineStyle;
121
+ underlineColor: number;
122
+ urlId: number;
123
+ clone(): IExtendedAttrs;
124
+ isEmpty(): boolean;
125
+ }
126
+
127
+ /**
128
+ * Tracks the current hyperlink. Since these are treated as extended attirbutes, these get passed on
129
+ * to the linkifier when anything is printed. Doing it this way ensures that even when the cursor
130
+ * moves around unexpectedly the link is tracked, as opposed to using a start position and
131
+ * finalizing it at the end.
132
+ */
133
+ export interface IOscLinkData {
134
+ id?: string;
135
+ uri: string;
136
+ }
137
+
138
+ /**
139
+ * An object that represents all attributes of a cell.
140
+ */
141
+ export interface IAttributeData {
142
+ /**
143
+ * "fg" is a 32-bit unsigned integer that stores the foreground color of the cell in the 24 least
144
+ * significant bits and additional flags in the remaining 8 bits.
145
+ */
146
+ fg: number;
147
+ /**
148
+ * "bg" is a 32-bit unsigned integer that stores the background color of the cell in the 24 least
149
+ * significant bits and additional flags in the remaining 8 bits.
150
+ */
151
+ bg: number;
152
+ /**
153
+ * "extended", aka "ext", stores extended attributes beyond those available in fg and bg. This
154
+ * data is optional on a cell and encodes less common data.
155
+ */
156
+ extended: IExtendedAttrs;
157
+
158
+ clone(): IAttributeData;
159
+
160
+ // flags
161
+ isInverse(): number;
162
+ isBold(): number;
163
+ isUnderline(): number;
164
+ isBlink(): number;
165
+ isInvisible(): number;
166
+ isItalic(): number;
167
+ isDim(): number;
168
+ isStrikethrough(): number;
169
+ isProtected(): number;
170
+ isOverline(): number;
171
+
172
+ /**
173
+ * The color mode of the foreground color which determines how to decode {@link getFgColor},
174
+ * possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
175
+ * {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
176
+ */
177
+ getFgColorMode(): number;
178
+ /**
179
+ * The color mode of the background color which determines how to decode {@link getBgColor},
180
+ * possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
181
+ * {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
182
+ */
183
+ getBgColorMode(): number;
184
+ isFgRGB(): boolean;
185
+ isBgRGB(): boolean;
186
+ isFgPalette(): boolean;
187
+ isBgPalette(): boolean;
188
+ isFgDefault(): boolean;
189
+ isBgDefault(): boolean;
190
+ isAttributeDefault(): boolean;
191
+
192
+ /**
193
+ * Gets an integer representation of the foreground color, how to decode the color depends on the
194
+ * color mode {@link getFgColorMode}.
195
+ */
196
+ getFgColor(): number;
197
+ /**
198
+ * Gets an integer representation of the background color, how to decode the color depends on the
199
+ * color mode {@link getBgColorMode}.
200
+ */
201
+ getBgColor(): number;
202
+
203
+ // extended attrs
204
+ hasExtendedAttrs(): number;
205
+ updateExtended(): void;
206
+ getUnderlineColor(): number;
207
+ getUnderlineColorMode(): number;
208
+ isUnderlineColorRGB(): boolean;
209
+ isUnderlineColorPalette(): boolean;
210
+ isUnderlineColorDefault(): boolean;
211
+ getUnderlineStyle(): number;
212
+ }
213
+
214
+ /** Cell data */
215
+ export interface ICellData extends IAttributeData {
216
+ content: number;
217
+ combinedData: string;
218
+ isCombined(): number;
219
+ getWidth(): number;
220
+ getChars(): string;
221
+ getCode(): number;
222
+ setFromCharData(value: CharData): void;
223
+ getAsCharData(): CharData;
224
+ }
225
+
226
+ /**
227
+ * Interface for a line in the terminal buffer.
228
+ */
229
+ export interface IBufferLine {
230
+ length: number;
231
+ isWrapped: boolean;
232
+ get(index: number): CharData;
233
+ set(index: number, value: CharData): void;
234
+ loadCell(index: number, cell: ICellData): ICellData;
235
+ setCell(index: number, cell: ICellData): void;
236
+ setCellFromCodePoint(index: number, codePoint: number, width: number, fg: number, bg: number, eAttrs: IExtendedAttrs): void;
237
+ addCodepointToCell(index: number, codePoint: number, width: number): void;
238
+ insertCells(pos: number, n: number, ch: ICellData, eraseAttr?: IAttributeData): void;
239
+ deleteCells(pos: number, n: number, fill: ICellData, eraseAttr?: IAttributeData): void;
240
+ replaceCells(start: number, end: number, fill: ICellData, eraseAttr?: IAttributeData, respectProtect?: boolean): void;
241
+ resize(cols: number, fill: ICellData): boolean;
242
+ cleanupMemory(): number;
243
+ fill(fillCellData: ICellData, respectProtect?: boolean): void;
244
+ copyFrom(line: IBufferLine): void;
245
+ clone(): IBufferLine;
246
+ getTrimmedLength(): number;
247
+ getNoBgTrimmedLength(): number;
248
+ translateToString(trimRight?: boolean, startCol?: number, endCol?: number): string;
249
+
250
+ /* direct access to cell attrs */
251
+ getWidth(index: number): number;
252
+ hasWidth(index: number): number;
253
+ getFg(index: number): number;
254
+ getBg(index: number): number;
255
+ hasContent(index: number): number;
256
+ getCodePoint(index: number): number;
257
+ isCombined(index: number): number;
258
+ getString(index: number): string;
259
+ }
260
+
261
+ export interface IMarker extends IDisposable {
262
+ readonly id: number;
263
+ readonly isDisposed: boolean;
264
+ readonly line: number;
265
+ onDispose: IEvent<void>;
266
+ }
267
+ export interface IModes {
268
+ insertMode: boolean;
269
+ }
270
+
271
+ export interface IDecPrivateModes {
272
+ applicationCursorKeys: boolean;
273
+ applicationKeypad: boolean;
274
+ bracketedPasteMode: boolean;
275
+ origin: boolean;
276
+ reverseWraparound: boolean;
277
+ sendFocus: boolean;
278
+ wraparound: boolean; // defaults: xterm - true, vt100 - false
279
+ }
280
+
281
+ export interface IRowRange {
282
+ start: number;
283
+ end: number;
284
+ }
285
+
286
+ /**
287
+ * Interface for mouse events in the core.
288
+ */
289
+ export const enum CoreMouseButton {
290
+ LEFT = 0,
291
+ MIDDLE = 1,
292
+ RIGHT = 2,
293
+ NONE = 3,
294
+ WHEEL = 4,
295
+ // additional buttons 1..8
296
+ // untested!
297
+ AUX1 = 8,
298
+ AUX2 = 9,
299
+ AUX3 = 10,
300
+ AUX4 = 11,
301
+ AUX5 = 12,
302
+ AUX6 = 13,
303
+ AUX7 = 14,
304
+ AUX8 = 15
305
+ }
306
+
307
+ export const enum CoreMouseAction {
308
+ UP = 0, // buttons, wheel
309
+ DOWN = 1, // buttons, wheel
310
+ LEFT = 2, // wheel only
311
+ RIGHT = 3, // wheel only
312
+ MOVE = 32 // buttons only
313
+ }
314
+
315
+ export interface ICoreMouseEvent {
316
+ /** column (zero based). */
317
+ col: number;
318
+ /** row (zero based). */
319
+ row: number;
320
+ /** xy pixel positions. */
321
+ x: number;
322
+ y: number;
323
+ /**
324
+ * Button the action occured. Due to restrictions of the tracking protocols
325
+ * it is not possible to report multiple buttons at once.
326
+ * Wheel is treated as a button.
327
+ * There are invalid combinations of buttons and actions possible
328
+ * (like move + wheel), those are silently ignored by the CoreMouseService.
329
+ */
330
+ button: CoreMouseButton;
331
+ action: CoreMouseAction;
332
+ /**
333
+ * Modifier states.
334
+ * Protocols will add/ignore those based on specific restrictions.
335
+ */
336
+ ctrl?: boolean;
337
+ alt?: boolean;
338
+ shift?: boolean;
339
+ }
340
+
341
+ /**
342
+ * CoreMouseEventType
343
+ * To be reported to the browser component which events a mouse
344
+ * protocol wants to be catched and forwarded as an ICoreMouseEvent
345
+ * to CoreMouseService.
346
+ */
347
+ export const enum CoreMouseEventType {
348
+ NONE = 0,
349
+ /** any mousedown event */
350
+ DOWN = 1,
351
+ /** any mouseup event */
352
+ UP = 2,
353
+ /** any mousemove event while a button is held */
354
+ DRAG = 4,
355
+ /** any mousemove event without a button */
356
+ MOVE = 8,
357
+ /** any wheel event */
358
+ WHEEL = 16
359
+ }
360
+
361
+ /**
362
+ * Mouse protocol interface.
363
+ * A mouse protocol can be registered and activated at the CoreMouseService.
364
+ * `events` should contain a list of needed events as a hint for the browser component
365
+ * to install/remove the appropriate event handlers.
366
+ * `restrict` applies further protocol specific restrictions like not allowed
367
+ * modifiers or filtering invalid event types.
368
+ */
369
+ export interface ICoreMouseProtocol {
370
+ events: CoreMouseEventType;
371
+ restrict: (e: ICoreMouseEvent) => boolean;
372
+ }
373
+
374
+ /**
375
+ * CoreMouseEncoding
376
+ * The tracking encoding can be registered and activated at the CoreMouseService.
377
+ * If a ICoreMouseEvent passes all procotol restrictions it will be encoded
378
+ * with the active encoding and sent out.
379
+ * Note: Returning an empty string will supress sending a mouse report,
380
+ * which can be used to skip creating falsey reports in limited encodings
381
+ * (DEFAULT only supports up to 223 1-based as coord value).
382
+ */
383
+ export type CoreMouseEncoding = (event: ICoreMouseEvent) => string;
384
+
385
+ /**
386
+ * windowOptions
387
+ */
388
+ export interface IWindowOptions {
389
+ restoreWin?: boolean;
390
+ minimizeWin?: boolean;
391
+ setWinPosition?: boolean;
392
+ setWinSizePixels?: boolean;
393
+ raiseWin?: boolean;
394
+ lowerWin?: boolean;
395
+ refreshWin?: boolean;
396
+ setWinSizeChars?: boolean;
397
+ maximizeWin?: boolean;
398
+ fullscreenWin?: boolean;
399
+ getWinState?: boolean;
400
+ getWinPosition?: boolean;
401
+ getWinSizePixels?: boolean;
402
+ getScreenSizePixels?: boolean;
403
+ getCellSizePixels?: boolean;
404
+ getWinSizeChars?: boolean;
405
+ getScreenSizeChars?: boolean;
406
+ getIconTitle?: boolean;
407
+ getWinTitle?: boolean;
408
+ pushTitle?: boolean;
409
+ popTitle?: boolean;
410
+ setWinLines?: boolean;
411
+ }
412
+
413
+ // color events from common, used for OSC 4/10/11/12 and 104/110/111/112
414
+ export const enum ColorRequestType {
415
+ REPORT = 0,
416
+ SET = 1,
417
+ RESTORE = 2
418
+ }
419
+
420
+ // IntRange from https://stackoverflow.com/a/39495173
421
+ type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N
422
+ ? Acc[number]
423
+ : Enumerate<N, [...Acc, Acc['length']]>;
424
+ type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
425
+
426
+ type ColorIndex = IntRange<0, 256>; // number from 0 to 255
427
+ type AllColorIndex = ColorIndex | SpecialColorIndex;
428
+ export const enum SpecialColorIndex {
429
+ FOREGROUND = 256,
430
+ BACKGROUND = 257,
431
+ CURSOR = 258
432
+ }
433
+ export interface IColorReportRequest {
434
+ type: ColorRequestType.REPORT;
435
+ index: AllColorIndex;
436
+ }
437
+ export interface IColorSetRequest {
438
+ type: ColorRequestType.SET;
439
+ index: AllColorIndex;
440
+ color: IColorRGB;
441
+ }
442
+ export interface IColorRestoreRequest {
443
+ type: ColorRequestType.RESTORE;
444
+ index?: AllColorIndex;
445
+ }
446
+ export type IColorEvent = (IColorReportRequest | IColorSetRequest | IColorRestoreRequest)[];
447
+
448
+
449
+ /**
450
+ * Calls the parser and handles actions generated by the parser.
451
+ */
452
+ export interface IInputHandler {
453
+ onTitleChange: IEvent<string>;
454
+
455
+ parse(data: string | Uint8Array, promiseResult?: boolean): void | Promise<boolean>;
456
+ print(data: Uint32Array, start: number, end: number): void;
457
+ registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise<boolean>): IDisposable;
458
+ registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise<boolean>): IDisposable;
459
+ registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise<boolean>): IDisposable;
460
+ registerOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
461
+
462
+ /** C0 BEL */ bell(): boolean;
463
+ /** C0 LF */ lineFeed(): boolean;
464
+ /** C0 CR */ carriageReturn(): boolean;
465
+ /** C0 BS */ backspace(): boolean;
466
+ /** C0 HT */ tab(): boolean;
467
+ /** C0 SO */ shiftOut(): boolean;
468
+ /** C0 SI */ shiftIn(): boolean;
469
+
470
+ /** CSI @ */ insertChars(params: IParams): boolean;
471
+ /** CSI SP @ */ scrollLeft(params: IParams): boolean;
472
+ /** CSI A */ cursorUp(params: IParams): boolean;
473
+ /** CSI SP A */ scrollRight(params: IParams): boolean;
474
+ /** CSI B */ cursorDown(params: IParams): boolean;
475
+ /** CSI C */ cursorForward(params: IParams): boolean;
476
+ /** CSI D */ cursorBackward(params: IParams): boolean;
477
+ /** CSI E */ cursorNextLine(params: IParams): boolean;
478
+ /** CSI F */ cursorPrecedingLine(params: IParams): boolean;
479
+ /** CSI G */ cursorCharAbsolute(params: IParams): boolean;
480
+ /** CSI H */ cursorPosition(params: IParams): boolean;
481
+ /** CSI I */ cursorForwardTab(params: IParams): boolean;
482
+ /** CSI J */ eraseInDisplay(params: IParams): boolean;
483
+ /** CSI K */ eraseInLine(params: IParams): boolean;
484
+ /** CSI L */ insertLines(params: IParams): boolean;
485
+ /** CSI M */ deleteLines(params: IParams): boolean;
486
+ /** CSI P */ deleteChars(params: IParams): boolean;
487
+ /** CSI S */ scrollUp(params: IParams): boolean;
488
+ /** CSI T */ scrollDown(params: IParams, collect?: string): boolean;
489
+ /** CSI X */ eraseChars(params: IParams): boolean;
490
+ /** CSI Z */ cursorBackwardTab(params: IParams): boolean;
491
+ /** CSI ` */ charPosAbsolute(params: IParams): boolean;
492
+ /** CSI a */ hPositionRelative(params: IParams): boolean;
493
+ /** CSI b */ repeatPrecedingCharacter(params: IParams): boolean;
494
+ /** CSI c */ sendDeviceAttributesPrimary(params: IParams): boolean;
495
+ /** CSI > c */ sendDeviceAttributesSecondary(params: IParams): boolean;
496
+ /** CSI d */ linePosAbsolute(params: IParams): boolean;
497
+ /** CSI e */ vPositionRelative(params: IParams): boolean;
498
+ /** CSI f */ hVPosition(params: IParams): boolean;
499
+ /** CSI g */ tabClear(params: IParams): boolean;
500
+ /** CSI h */ setMode(params: IParams, collect?: string): boolean;
501
+ /** CSI l */ resetMode(params: IParams, collect?: string): boolean;
502
+ /** CSI m */ charAttributes(params: IParams): boolean;
503
+ /** CSI n */ deviceStatus(params: IParams, collect?: string): boolean;
504
+ /** CSI p */ softReset(params: IParams, collect?: string): boolean;
505
+ /** CSI q */ setCursorStyle(params: IParams, collect?: string): boolean;
506
+ /** CSI r */ setScrollRegion(params: IParams, collect?: string): boolean;
507
+ /** CSI s */ saveCursor(params: IParams): boolean;
508
+ /** CSI u */ restoreCursor(params: IParams): boolean;
509
+ /** CSI ' } */ insertColumns(params: IParams): boolean;
510
+ /** CSI ' ~ */ deleteColumns(params: IParams): boolean;
511
+
512
+ /** OSC 0
513
+ OSC 2 */ setTitle(data: string): boolean;
514
+ /** OSC 4 */ setOrReportIndexedColor(data: string): boolean;
515
+ /** OSC 10 */ setOrReportFgColor(data: string): boolean;
516
+ /** OSC 11 */ setOrReportBgColor(data: string): boolean;
517
+ /** OSC 12 */ setOrReportCursorColor(data: string): boolean;
518
+ /** OSC 104 */ restoreIndexedColor(data: string): boolean;
519
+ /** OSC 110 */ restoreFgColor(data: string): boolean;
520
+ /** OSC 111 */ restoreBgColor(data: string): boolean;
521
+ /** OSC 112 */ restoreCursorColor(data: string): boolean;
522
+
523
+ /** ESC E */ nextLine(): boolean;
524
+ /** ESC = */ keypadApplicationMode(): boolean;
525
+ /** ESC > */ keypadNumericMode(): boolean;
526
+ /** ESC % G
527
+ ESC % @ */ selectDefaultCharset(): boolean;
528
+ /** ESC ( C
529
+ ESC ) C
530
+ ESC * C
531
+ ESC + C
532
+ ESC - C
533
+ ESC . C
534
+ ESC / C */ selectCharset(collectAndFlag: string): boolean;
535
+ /** ESC D */ index(): boolean;
536
+ /** ESC H */ tabSet(): boolean;
537
+ /** ESC M */ reverseIndex(): boolean;
538
+ /** ESC c */ fullReset(): boolean;
539
+ /** ESC n
540
+ ESC o
541
+ ESC |
542
+ ESC }
543
+ ESC ~ */ setgLevel(level: number): boolean;
544
+ /** ESC # 8 */ screenAlignmentPattern(): boolean;
545
+ }
546
+
547
+ export interface IParseStack {
548
+ paused: boolean;
549
+ cursorStartX: number;
550
+ cursorStartY: number;
551
+ decodedLength: number;
552
+ position: number;
553
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright (c) 2019 The xterm.js authors. All rights reserved.
3
+ * @license MIT
4
+ */
5
+
6
+ import { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from 'common/buffer/Constants';
7
+ import { IBufferService } from 'common/services/Services';
8
+
9
+ export function updateWindowsModeWrappedState(bufferService: IBufferService): void {
10
+ // Winpty does not support wraparound mode which means that lines will never
11
+ // be marked as wrapped. This causes issues for things like copying a line
12
+ // retaining the wrapped new line characters or if consumers are listening
13
+ // in on the data stream.
14
+ //
15
+ // The workaround for this is to listen to every incoming line feed and mark
16
+ // the line as wrapped if the last character in the previous line is not a
17
+ // space. This is certainly not without its problems, but generally on
18
+ // Windows when text reaches the end of the terminal it's likely going to be
19
+ // wrapped.
20
+ const line = bufferService.buffer.lines.get(bufferService.buffer.ybase + bufferService.buffer.y - 1);
21
+ const lastChar = line?.get(bufferService.cols - 1);
22
+
23
+ const nextLine = bufferService.buffer.lines.get(bufferService.buffer.ybase + bufferService.buffer.y);
24
+ if (nextLine && lastChar) {
25
+ nextLine.isWrapped = (lastChar[CHAR_DATA_CODE_INDEX] !== NULL_CELL_CODE && lastChar[CHAR_DATA_CODE_INDEX] !== WHITESPACE_CELL_CODE);
26
+ }
27
+ }