@wendongfly/myhi 1.0.2 → 1.0.3

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 (135) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/lib/xterm/LICENSE +21 -0
  3. package/dist/lib/xterm/README.md +225 -0
  4. package/dist/lib/xterm/css/xterm.css +190 -0
  5. package/dist/lib/xterm/lib/xterm.js +2 -0
  6. package/dist/lib/xterm/lib/xterm.js.map +1 -0
  7. package/dist/lib/xterm/package.json +90 -0
  8. package/dist/lib/xterm/src/browser/AccessibilityManager.ts +301 -0
  9. package/dist/lib/xterm/src/browser/Clipboard.ts +99 -0
  10. package/dist/lib/xterm/src/browser/ColorContrastCache.ts +39 -0
  11. package/dist/lib/xterm/src/browser/ColorManager.ts +268 -0
  12. package/dist/lib/xterm/src/browser/Dom.ts +10 -0
  13. package/dist/lib/xterm/src/browser/Lifecycle.ts +30 -0
  14. package/dist/lib/xterm/src/browser/Linkifier.ts +356 -0
  15. package/dist/lib/xterm/src/browser/Linkifier2.ts +397 -0
  16. package/dist/lib/xterm/src/browser/LocalizableStrings.ts +10 -0
  17. package/dist/lib/xterm/src/browser/MouseZoneManager.ts +236 -0
  18. package/dist/lib/xterm/src/browser/RenderDebouncer.ts +82 -0
  19. package/dist/lib/xterm/src/browser/ScreenDprMonitor.ts +69 -0
  20. package/dist/lib/xterm/src/browser/Terminal.ts +1447 -0
  21. package/dist/lib/xterm/src/browser/TimeBasedDebouncer.ts +86 -0
  22. package/dist/lib/xterm/src/browser/Types.d.ts +317 -0
  23. package/dist/lib/xterm/src/browser/Viewport.ts +276 -0
  24. package/dist/lib/xterm/src/browser/decorations/BufferDecorationRenderer.ts +131 -0
  25. package/dist/lib/xterm/src/browser/decorations/ColorZoneStore.ts +117 -0
  26. package/dist/lib/xterm/src/browser/decorations/OverviewRulerRenderer.ts +228 -0
  27. package/dist/lib/xterm/src/browser/input/CompositionHelper.ts +237 -0
  28. package/dist/lib/xterm/src/browser/input/Mouse.ts +64 -0
  29. package/dist/lib/xterm/src/browser/input/MoveToCell.ts +249 -0
  30. package/dist/lib/xterm/src/browser/public/Terminal.ts +298 -0
  31. package/dist/lib/xterm/src/browser/renderer/BaseRenderLayer.ts +582 -0
  32. package/dist/lib/xterm/src/browser/renderer/CursorRenderLayer.ts +378 -0
  33. package/dist/lib/xterm/src/browser/renderer/CustomGlyphs.ts +632 -0
  34. package/dist/lib/xterm/src/browser/renderer/GridCache.ts +33 -0
  35. package/dist/lib/xterm/src/browser/renderer/LinkRenderLayer.ts +84 -0
  36. package/dist/lib/xterm/src/browser/renderer/Renderer.ts +219 -0
  37. package/dist/lib/xterm/src/browser/renderer/RendererUtils.ts +26 -0
  38. package/dist/lib/xterm/src/browser/renderer/SelectionRenderLayer.ts +131 -0
  39. package/dist/lib/xterm/src/browser/renderer/TextRenderLayer.ts +344 -0
  40. package/dist/lib/xterm/src/browser/renderer/Types.d.ts +109 -0
  41. package/dist/lib/xterm/src/browser/renderer/atlas/BaseCharAtlas.ts +58 -0
  42. package/dist/lib/xterm/src/browser/renderer/atlas/CharAtlasCache.ts +95 -0
  43. package/dist/lib/xterm/src/browser/renderer/atlas/CharAtlasUtils.ts +54 -0
  44. package/dist/lib/xterm/src/browser/renderer/atlas/Constants.ts +15 -0
  45. package/dist/lib/xterm/src/browser/renderer/atlas/DynamicCharAtlas.ts +404 -0
  46. package/dist/lib/xterm/src/browser/renderer/atlas/LRUMap.ts +136 -0
  47. package/dist/lib/xterm/src/browser/renderer/atlas/Types.d.ts +29 -0
  48. package/dist/lib/xterm/src/browser/renderer/dom/DomRenderer.ts +403 -0
  49. package/dist/lib/xterm/src/browser/renderer/dom/DomRendererRowFactory.ts +344 -0
  50. package/dist/lib/xterm/src/browser/selection/SelectionModel.ts +144 -0
  51. package/dist/lib/xterm/src/browser/selection/Types.d.ts +15 -0
  52. package/dist/lib/xterm/src/browser/services/CharSizeService.ts +87 -0
  53. package/dist/lib/xterm/src/browser/services/CharacterJoinerService.ts +339 -0
  54. package/dist/lib/xterm/src/browser/services/CoreBrowserService.ts +20 -0
  55. package/dist/lib/xterm/src/browser/services/MouseService.ts +36 -0
  56. package/dist/lib/xterm/src/browser/services/RenderService.ts +237 -0
  57. package/dist/lib/xterm/src/browser/services/SelectionService.ts +1027 -0
  58. package/dist/lib/xterm/src/browser/services/Services.ts +123 -0
  59. package/dist/lib/xterm/src/browser/services/SoundService.ts +63 -0
  60. package/dist/lib/xterm/src/common/CircularList.ts +239 -0
  61. package/dist/lib/xterm/src/common/Clone.ts +23 -0
  62. package/dist/lib/xterm/src/common/Color.ts +285 -0
  63. package/dist/lib/xterm/src/common/CoreTerminal.ts +300 -0
  64. package/dist/lib/xterm/src/common/EventEmitter.ts +69 -0
  65. package/dist/lib/xterm/src/common/InputHandler.ts +3230 -0
  66. package/dist/lib/xterm/src/common/Lifecycle.ts +68 -0
  67. package/dist/lib/xterm/src/common/Platform.ts +31 -0
  68. package/dist/lib/xterm/src/common/SortedList.ts +88 -0
  69. package/dist/lib/xterm/src/common/TypedArrayUtils.ts +50 -0
  70. package/dist/lib/xterm/src/common/Types.d.ts +489 -0
  71. package/dist/lib/xterm/src/common/WindowsMode.ts +27 -0
  72. package/dist/lib/xterm/src/common/buffer/AttributeData.ts +148 -0
  73. package/dist/lib/xterm/src/common/buffer/Buffer.ts +711 -0
  74. package/dist/lib/xterm/src/common/buffer/BufferLine.ts +441 -0
  75. package/dist/lib/xterm/src/common/buffer/BufferRange.ts +13 -0
  76. package/dist/lib/xterm/src/common/buffer/BufferReflow.ts +220 -0
  77. package/dist/lib/xterm/src/common/buffer/BufferSet.ts +131 -0
  78. package/dist/lib/xterm/src/common/buffer/CellData.ts +94 -0
  79. package/dist/lib/xterm/src/common/buffer/Constants.ts +139 -0
  80. package/dist/lib/xterm/src/common/buffer/Marker.ts +37 -0
  81. package/dist/lib/xterm/src/common/buffer/Types.d.ts +64 -0
  82. package/dist/lib/xterm/src/common/data/Charsets.ts +256 -0
  83. package/dist/lib/xterm/src/common/data/EscapeSequences.ts +153 -0
  84. package/dist/lib/xterm/src/common/input/Keyboard.ts +398 -0
  85. package/dist/lib/xterm/src/common/input/TextDecoder.ts +346 -0
  86. package/dist/lib/xterm/src/common/input/UnicodeV6.ts +133 -0
  87. package/dist/lib/xterm/src/common/input/WriteBuffer.ts +229 -0
  88. package/dist/lib/xterm/src/common/input/XParseColor.ts +80 -0
  89. package/dist/lib/xterm/src/common/parser/Constants.ts +58 -0
  90. package/dist/lib/xterm/src/common/parser/DcsParser.ts +192 -0
  91. package/dist/lib/xterm/src/common/parser/EscapeSequenceParser.ts +796 -0
  92. package/dist/lib/xterm/src/common/parser/OscParser.ts +238 -0
  93. package/dist/lib/xterm/src/common/parser/Params.ts +229 -0
  94. package/dist/lib/xterm/src/common/parser/Types.d.ts +274 -0
  95. package/dist/lib/xterm/src/common/public/AddonManager.ts +56 -0
  96. package/dist/lib/xterm/src/common/public/BufferApiView.ts +35 -0
  97. package/dist/lib/xterm/src/common/public/BufferLineApiView.ts +29 -0
  98. package/dist/lib/xterm/src/common/public/BufferNamespaceApi.ts +33 -0
  99. package/dist/lib/xterm/src/common/public/ParserApi.ts +37 -0
  100. package/dist/lib/xterm/src/common/public/UnicodeApi.ts +27 -0
  101. package/dist/lib/xterm/src/common/services/BufferService.ts +185 -0
  102. package/dist/lib/xterm/src/common/services/CharsetService.ts +34 -0
  103. package/dist/lib/xterm/src/common/services/CoreMouseService.ts +309 -0
  104. package/dist/lib/xterm/src/common/services/CoreService.ts +92 -0
  105. package/dist/lib/xterm/src/common/services/DecorationService.ts +139 -0
  106. package/dist/lib/xterm/src/common/services/DirtyRowService.ts +53 -0
  107. package/dist/lib/xterm/src/common/services/InstantiationService.ts +83 -0
  108. package/dist/lib/xterm/src/common/services/LogService.ts +88 -0
  109. package/dist/lib/xterm/src/common/services/OptionsService.ts +178 -0
  110. package/dist/lib/xterm/src/common/services/ServiceRegistry.ts +49 -0
  111. package/dist/lib/xterm/src/common/services/Services.ts +323 -0
  112. package/dist/lib/xterm/src/common/services/UnicodeService.ts +82 -0
  113. package/dist/lib/xterm/src/headless/Terminal.ts +170 -0
  114. package/dist/lib/xterm/src/headless/Types.d.ts +31 -0
  115. package/dist/lib/xterm/src/headless/public/Terminal.ts +216 -0
  116. package/dist/lib/xterm/typings/xterm.d.ts +1872 -0
  117. package/dist/lib/xterm-fit/LICENSE +19 -0
  118. package/dist/lib/xterm-fit/README.md +24 -0
  119. package/dist/lib/xterm-fit/lib/xterm-addon-fit.js +2 -0
  120. package/dist/lib/xterm-fit/lib/xterm-addon-fit.js.map +1 -0
  121. package/dist/lib/xterm-fit/out/FitAddon.js +58 -0
  122. package/dist/lib/xterm-fit/out/FitAddon.js.map +1 -0
  123. package/dist/lib/xterm-fit/out-test/FitAddon.api.js.map +1 -0
  124. package/dist/lib/xterm-fit/package.json +21 -0
  125. package/dist/lib/xterm-fit/src/FitAddon.ts +86 -0
  126. package/dist/lib/xterm-fit/typings/xterm-addon-fit.d.ts +55 -0
  127. package/dist/lib/xterm-links/LICENSE +19 -0
  128. package/dist/lib/xterm-links/README.md +21 -0
  129. package/dist/lib/xterm-links/lib/xterm-addon-web-links.js +2 -0
  130. package/dist/lib/xterm-links/lib/xterm-addon-web-links.js.map +1 -0
  131. package/dist/lib/xterm-links/package.json +26 -0
  132. package/dist/lib/xterm-links/src/WebLinkProvider.ts +145 -0
  133. package/dist/lib/xterm-links/src/WebLinksAddon.ts +77 -0
  134. package/dist/lib/xterm-links/typings/xterm-addon-web-links.d.ts +58 -0
  135. package/package.json +1 -1
@@ -0,0 +1,489 @@
1
+ /**
2
+ * Copyright (c) 2018 The xterm.js authors. All rights reserved.
3
+ * @license MIT
4
+ */
5
+
6
+ import { IFunctionIdentifier, ITerminalOptions as IPublicTerminalOptions } from 'xterm';
7
+ import { IEvent, IEventEmitter } from 'common/EventEmitter';
8
+ import { IDeleteEvent, IInsertEvent } from 'common/CircularList';
9
+ import { IParams } from 'common/parser/Types';
10
+ import { ICoreMouseService, ICoreService, IOptionsService, IUnicodeService } from 'common/services/Services';
11
+ import { IBufferSet } from 'common/buffer/Types';
12
+
13
+ export interface ICoreTerminal {
14
+ coreMouseService: ICoreMouseService;
15
+ coreService: ICoreService;
16
+ optionsService: IOptionsService;
17
+ unicodeService: IUnicodeService;
18
+ buffers: IBufferSet;
19
+ options: ITerminalOptions;
20
+ registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise<boolean>): IDisposable;
21
+ registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise<boolean>): IDisposable;
22
+ registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise<boolean>): IDisposable;
23
+ registerOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
24
+ }
25
+
26
+ export interface IDisposable {
27
+ dispose(): void;
28
+ }
29
+
30
+ // TODO: The options that are not in the public API should be reviewed
31
+ export interface ITerminalOptions extends IPublicTerminalOptions {
32
+ [key: string]: any;
33
+ cancelEvents?: boolean;
34
+ convertEol?: boolean;
35
+ termName?: string;
36
+ }
37
+
38
+ export type XtermListener = (...args: any[]) => void;
39
+
40
+ /**
41
+ * A keyboard event interface which does not depend on the DOM, KeyboardEvent implicitly extends
42
+ * this event.
43
+ */
44
+ export interface IKeyboardEvent {
45
+ altKey: boolean;
46
+ ctrlKey: boolean;
47
+ shiftKey: boolean;
48
+ metaKey: boolean;
49
+ /** @deprecated See KeyboardEvent.keyCode */
50
+ keyCode: number;
51
+ key: string;
52
+ type: string;
53
+ code: string;
54
+ }
55
+
56
+ export interface IScrollEvent {
57
+ position: number;
58
+ source: ScrollSource;
59
+ }
60
+
61
+ export const enum ScrollSource {
62
+ TERMINAL,
63
+ VIEWPORT,
64
+ }
65
+
66
+ export interface ICircularList<T> {
67
+ length: number;
68
+ maxLength: number;
69
+ isFull: boolean;
70
+
71
+ onDeleteEmitter: IEventEmitter<IDeleteEvent>;
72
+ onDelete: IEvent<IDeleteEvent>;
73
+ onInsertEmitter: IEventEmitter<IInsertEvent>;
74
+ onInsert: IEvent<IInsertEvent>;
75
+ onTrimEmitter: IEventEmitter<number>;
76
+ onTrim: IEvent<number>;
77
+
78
+ get(index: number): T | undefined;
79
+ set(index: number, value: T): void;
80
+ push(value: T): void;
81
+ recycle(): T;
82
+ pop(): T | undefined;
83
+ splice(start: number, deleteCount: number, ...items: T[]): void;
84
+ trimStart(count: number): void;
85
+ shiftElements(start: number, count: number, offset: number): void;
86
+ }
87
+
88
+ export const enum KeyboardResultType {
89
+ SEND_KEY,
90
+ SELECT_ALL,
91
+ PAGE_UP,
92
+ PAGE_DOWN
93
+ }
94
+
95
+ export interface IKeyboardResult {
96
+ type: KeyboardResultType;
97
+ cancel: boolean;
98
+ key: string | undefined;
99
+ }
100
+
101
+ export interface ICharset {
102
+ [key: string]: string | undefined;
103
+ }
104
+
105
+ export type CharData = [number, string, number, number];
106
+
107
+ export interface IColor {
108
+ css: string;
109
+ rgba: number; // 32-bit int with rgba in each byte
110
+ }
111
+ export type IColorRGB = [number, number, number];
112
+
113
+ export interface IExtendedAttrs {
114
+ underlineStyle: number;
115
+ underlineColor: number;
116
+ clone(): IExtendedAttrs;
117
+ isEmpty(): boolean;
118
+ }
119
+
120
+ /** Attribute data */
121
+ export interface IAttributeData {
122
+ fg: number;
123
+ bg: number;
124
+ extended: IExtendedAttrs;
125
+
126
+ clone(): IAttributeData;
127
+
128
+ // flags
129
+ isInverse(): number;
130
+ isBold(): number;
131
+ isUnderline(): number;
132
+ isBlink(): number;
133
+ isInvisible(): number;
134
+ isItalic(): number;
135
+ isDim(): number;
136
+ isStrikethrough(): number;
137
+
138
+ // color modes
139
+ getFgColorMode(): number;
140
+ getBgColorMode(): number;
141
+ isFgRGB(): boolean;
142
+ isBgRGB(): boolean;
143
+ isFgPalette(): boolean;
144
+ isBgPalette(): boolean;
145
+ isFgDefault(): boolean;
146
+ isBgDefault(): boolean;
147
+ isAttributeDefault(): boolean;
148
+
149
+ // colors
150
+ getFgColor(): number;
151
+ getBgColor(): number;
152
+
153
+ // extended attrs
154
+ hasExtendedAttrs(): number;
155
+ updateExtended(): void;
156
+ getUnderlineColor(): number;
157
+ getUnderlineColorMode(): number;
158
+ isUnderlineColorRGB(): boolean;
159
+ isUnderlineColorPalette(): boolean;
160
+ isUnderlineColorDefault(): boolean;
161
+ getUnderlineStyle(): number;
162
+ }
163
+
164
+ /** Cell data */
165
+ export interface ICellData extends IAttributeData {
166
+ content: number;
167
+ combinedData: string;
168
+ isCombined(): number;
169
+ getWidth(): number;
170
+ getChars(): string;
171
+ getCode(): number;
172
+ setFromCharData(value: CharData): void;
173
+ getAsCharData(): CharData;
174
+ }
175
+
176
+ /**
177
+ * Interface for a line in the terminal buffer.
178
+ */
179
+ export interface IBufferLine {
180
+ length: number;
181
+ isWrapped: boolean;
182
+ get(index: number): CharData;
183
+ set(index: number, value: CharData): void;
184
+ loadCell(index: number, cell: ICellData): ICellData;
185
+ setCell(index: number, cell: ICellData): void;
186
+ setCellFromCodePoint(index: number, codePoint: number, width: number, fg: number, bg: number, eAttrs: IExtendedAttrs): void;
187
+ addCodepointToCell(index: number, codePoint: number): void;
188
+ insertCells(pos: number, n: number, ch: ICellData, eraseAttr?: IAttributeData): void;
189
+ deleteCells(pos: number, n: number, fill: ICellData, eraseAttr?: IAttributeData): void;
190
+ replaceCells(start: number, end: number, fill: ICellData, eraseAttr?: IAttributeData): void;
191
+ resize(cols: number, fill: ICellData): void;
192
+ fill(fillCellData: ICellData): void;
193
+ copyFrom(line: IBufferLine): void;
194
+ clone(): IBufferLine;
195
+ getTrimmedLength(): number;
196
+ translateToString(trimRight?: boolean, startCol?: number, endCol?: number): string;
197
+
198
+ /* direct access to cell attrs */
199
+ getWidth(index: number): number;
200
+ hasWidth(index: number): number;
201
+ getFg(index: number): number;
202
+ getBg(index: number): number;
203
+ hasContent(index: number): number;
204
+ getCodePoint(index: number): number;
205
+ isCombined(index: number): number;
206
+ getString(index: number): string;
207
+ }
208
+
209
+ export interface IMarker extends IDisposable {
210
+ readonly id: number;
211
+ readonly isDisposed: boolean;
212
+ readonly line: number;
213
+ onDispose: IEvent<void>;
214
+ }
215
+ export interface IModes {
216
+ insertMode: boolean;
217
+ }
218
+
219
+ export interface IDecPrivateModes {
220
+ applicationCursorKeys: boolean;
221
+ applicationKeypad: boolean;
222
+ bracketedPasteMode: boolean;
223
+ origin: boolean;
224
+ reverseWraparound: boolean;
225
+ sendFocus: boolean;
226
+ wraparound: boolean; // defaults: xterm - true, vt100 - false
227
+ }
228
+
229
+ export interface IRowRange {
230
+ start: number;
231
+ end: number;
232
+ }
233
+
234
+ /**
235
+ * Interface for mouse events in the core.
236
+ */
237
+ export const enum CoreMouseButton {
238
+ LEFT = 0,
239
+ MIDDLE = 1,
240
+ RIGHT = 2,
241
+ NONE = 3,
242
+ WHEEL = 4,
243
+ // additional buttons 1..8
244
+ // untested!
245
+ AUX1 = 8,
246
+ AUX2 = 9,
247
+ AUX3 = 10,
248
+ AUX4 = 11,
249
+ AUX5 = 12,
250
+ AUX6 = 13,
251
+ AUX7 = 14,
252
+ AUX8 = 15
253
+ }
254
+
255
+ export const enum CoreMouseAction {
256
+ UP = 0, // buttons, wheel
257
+ DOWN = 1, // buttons, wheel
258
+ LEFT = 2, // wheel only
259
+ RIGHT = 3, // wheel only
260
+ MOVE = 32 // buttons only
261
+ }
262
+
263
+ export interface ICoreMouseEvent {
264
+ /** column (zero based). */
265
+ col: number;
266
+ /** row (zero based). */
267
+ row: number;
268
+ /**
269
+ * Button the action occured. Due to restrictions of the tracking protocols
270
+ * it is not possible to report multiple buttons at once.
271
+ * Wheel is treated as a button.
272
+ * There are invalid combinations of buttons and actions possible
273
+ * (like move + wheel), those are silently ignored by the CoreMouseService.
274
+ */
275
+ button: CoreMouseButton;
276
+ action: CoreMouseAction;
277
+ /**
278
+ * Modifier states.
279
+ * Protocols will add/ignore those based on specific restrictions.
280
+ */
281
+ ctrl?: boolean;
282
+ alt?: boolean;
283
+ shift?: boolean;
284
+ }
285
+
286
+ /**
287
+ * CoreMouseEventType
288
+ * To be reported to the browser component which events a mouse
289
+ * protocol wants to be catched and forwarded as an ICoreMouseEvent
290
+ * to CoreMouseService.
291
+ */
292
+ export const enum CoreMouseEventType {
293
+ NONE = 0,
294
+ /** any mousedown event */
295
+ DOWN = 1,
296
+ /** any mouseup event */
297
+ UP = 2,
298
+ /** any mousemove event while a button is held */
299
+ DRAG = 4,
300
+ /** any mousemove event without a button */
301
+ MOVE = 8,
302
+ /** any wheel event */
303
+ WHEEL = 16
304
+ }
305
+
306
+ /**
307
+ * Mouse protocol interface.
308
+ * A mouse protocol can be registered and activated at the CoreMouseService.
309
+ * `events` should contain a list of needed events as a hint for the browser component
310
+ * to install/remove the appropriate event handlers.
311
+ * `restrict` applies further protocol specific restrictions like not allowed
312
+ * modifiers or filtering invalid event types.
313
+ */
314
+ export interface ICoreMouseProtocol {
315
+ events: CoreMouseEventType;
316
+ restrict: (e: ICoreMouseEvent) => boolean;
317
+ }
318
+
319
+ /**
320
+ * CoreMouseEncoding
321
+ * The tracking encoding can be registered and activated at the CoreMouseService.
322
+ * If a ICoreMouseEvent passes all procotol restrictions it will be encoded
323
+ * with the active encoding and sent out.
324
+ * Note: Returning an empty string will supress sending a mouse report,
325
+ * which can be used to skip creating falsey reports in limited encodings
326
+ * (DEFAULT only supports up to 223 1-based as coord value).
327
+ */
328
+ export type CoreMouseEncoding = (event: ICoreMouseEvent) => string;
329
+
330
+ /**
331
+ * windowOptions
332
+ */
333
+ export interface IWindowOptions {
334
+ restoreWin?: boolean;
335
+ minimizeWin?: boolean;
336
+ setWinPosition?: boolean;
337
+ setWinSizePixels?: boolean;
338
+ raiseWin?: boolean;
339
+ lowerWin?: boolean;
340
+ refreshWin?: boolean;
341
+ setWinSizeChars?: boolean;
342
+ maximizeWin?: boolean;
343
+ fullscreenWin?: boolean;
344
+ getWinState?: boolean;
345
+ getWinPosition?: boolean;
346
+ getWinSizePixels?: boolean;
347
+ getScreenSizePixels?: boolean;
348
+ getCellSizePixels?: boolean;
349
+ getWinSizeChars?: boolean;
350
+ getScreenSizeChars?: boolean;
351
+ getIconTitle?: boolean;
352
+ getWinTitle?: boolean;
353
+ pushTitle?: boolean;
354
+ popTitle?: boolean;
355
+ setWinLines?: boolean;
356
+ }
357
+
358
+ // color events from common, used for OSC 4/10/11/12 and 104/110/111/112
359
+ export const enum ColorRequestType {
360
+ REPORT = 0,
361
+ SET = 1,
362
+ RESTORE = 2
363
+ }
364
+ export const enum ColorIndex {
365
+ FOREGROUND = 256,
366
+ BACKGROUND = 257,
367
+ CURSOR = 258
368
+ }
369
+ export interface IColorReportRequest {
370
+ type: ColorRequestType.REPORT;
371
+ index: ColorIndex;
372
+ }
373
+ export interface IColorSetRequest {
374
+ type: ColorRequestType.SET;
375
+ index: ColorIndex;
376
+ color: IColorRGB;
377
+ }
378
+ export interface IColorRestoreRequest {
379
+ type: ColorRequestType.RESTORE;
380
+ index?: ColorIndex;
381
+ }
382
+ export type IColorEvent = (IColorReportRequest | IColorSetRequest | IColorRestoreRequest)[];
383
+
384
+
385
+ /**
386
+ * Calls the parser and handles actions generated by the parser.
387
+ */
388
+ export interface IInputHandler {
389
+ onTitleChange: IEvent<string>;
390
+
391
+ parse(data: string | Uint8Array, promiseResult?: boolean): void | Promise<boolean>;
392
+ print(data: Uint32Array, start: number, end: number): void;
393
+ registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise<boolean>): IDisposable;
394
+ registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise<boolean>): IDisposable;
395
+ registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise<boolean>): IDisposable;
396
+ registerOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
397
+
398
+ /** C0 BEL */ bell(): boolean;
399
+ /** C0 LF */ lineFeed(): boolean;
400
+ /** C0 CR */ carriageReturn(): boolean;
401
+ /** C0 BS */ backspace(): boolean;
402
+ /** C0 HT */ tab(): boolean;
403
+ /** C0 SO */ shiftOut(): boolean;
404
+ /** C0 SI */ shiftIn(): boolean;
405
+
406
+ /** CSI @ */ insertChars(params: IParams): boolean;
407
+ /** CSI SP @ */ scrollLeft(params: IParams): boolean;
408
+ /** CSI A */ cursorUp(params: IParams): boolean;
409
+ /** CSI SP A */ scrollRight(params: IParams): boolean;
410
+ /** CSI B */ cursorDown(params: IParams): boolean;
411
+ /** CSI C */ cursorForward(params: IParams): boolean;
412
+ /** CSI D */ cursorBackward(params: IParams): boolean;
413
+ /** CSI E */ cursorNextLine(params: IParams): boolean;
414
+ /** CSI F */ cursorPrecedingLine(params: IParams): boolean;
415
+ /** CSI G */ cursorCharAbsolute(params: IParams): boolean;
416
+ /** CSI H */ cursorPosition(params: IParams): boolean;
417
+ /** CSI I */ cursorForwardTab(params: IParams): boolean;
418
+ /** CSI J */ eraseInDisplay(params: IParams): boolean;
419
+ /** CSI K */ eraseInLine(params: IParams): boolean;
420
+ /** CSI L */ insertLines(params: IParams): boolean;
421
+ /** CSI M */ deleteLines(params: IParams): boolean;
422
+ /** CSI P */ deleteChars(params: IParams): boolean;
423
+ /** CSI S */ scrollUp(params: IParams): boolean;
424
+ /** CSI T */ scrollDown(params: IParams, collect?: string): boolean;
425
+ /** CSI X */ eraseChars(params: IParams): boolean;
426
+ /** CSI Z */ cursorBackwardTab(params: IParams): boolean;
427
+ /** CSI ` */ charPosAbsolute(params: IParams): boolean;
428
+ /** CSI a */ hPositionRelative(params: IParams): boolean;
429
+ /** CSI b */ repeatPrecedingCharacter(params: IParams): boolean;
430
+ /** CSI c */ sendDeviceAttributesPrimary(params: IParams): boolean;
431
+ /** CSI > c */ sendDeviceAttributesSecondary(params: IParams): boolean;
432
+ /** CSI d */ linePosAbsolute(params: IParams): boolean;
433
+ /** CSI e */ vPositionRelative(params: IParams): boolean;
434
+ /** CSI f */ hVPosition(params: IParams): boolean;
435
+ /** CSI g */ tabClear(params: IParams): boolean;
436
+ /** CSI h */ setMode(params: IParams, collect?: string): boolean;
437
+ /** CSI l */ resetMode(params: IParams, collect?: string): boolean;
438
+ /** CSI m */ charAttributes(params: IParams): boolean;
439
+ /** CSI n */ deviceStatus(params: IParams, collect?: string): boolean;
440
+ /** CSI p */ softReset(params: IParams, collect?: string): boolean;
441
+ /** CSI q */ setCursorStyle(params: IParams, collect?: string): boolean;
442
+ /** CSI r */ setScrollRegion(params: IParams, collect?: string): boolean;
443
+ /** CSI s */ saveCursor(params: IParams): boolean;
444
+ /** CSI u */ restoreCursor(params: IParams): boolean;
445
+ /** CSI ' } */ insertColumns(params: IParams): boolean;
446
+ /** CSI ' ~ */ deleteColumns(params: IParams): boolean;
447
+
448
+ /** OSC 0
449
+ OSC 2 */ setTitle(data: string): boolean;
450
+ /** OSC 4 */ setOrReportIndexedColor(data: string): boolean;
451
+ /** OSC 10 */ setOrReportFgColor(data: string): boolean;
452
+ /** OSC 11 */ setOrReportBgColor(data: string): boolean;
453
+ /** OSC 12 */ setOrReportCursorColor(data: string): boolean;
454
+ /** OSC 104 */ restoreIndexedColor(data: string): boolean;
455
+ /** OSC 110 */ restoreFgColor(data: string): boolean;
456
+ /** OSC 111 */ restoreBgColor(data: string): boolean;
457
+ /** OSC 112 */ restoreCursorColor(data: string): boolean;
458
+
459
+ /** ESC E */ nextLine(): boolean;
460
+ /** ESC = */ keypadApplicationMode(): boolean;
461
+ /** ESC > */ keypadNumericMode(): boolean;
462
+ /** ESC % G
463
+ ESC % @ */ selectDefaultCharset(): boolean;
464
+ /** ESC ( C
465
+ ESC ) C
466
+ ESC * C
467
+ ESC + C
468
+ ESC - C
469
+ ESC . C
470
+ ESC / C */ selectCharset(collectAndFlag: string): boolean;
471
+ /** ESC D */ index(): boolean;
472
+ /** ESC H */ tabSet(): boolean;
473
+ /** ESC M */ reverseIndex(): boolean;
474
+ /** ESC c */ fullReset(): boolean;
475
+ /** ESC n
476
+ ESC o
477
+ ESC |
478
+ ESC }
479
+ ESC ~ */ setgLevel(level: number): boolean;
480
+ /** ESC # 8 */ screenAlignmentPattern(): boolean;
481
+ }
482
+
483
+ interface IParseStack {
484
+ paused: boolean;
485
+ cursorStartX: number;
486
+ cursorStartY: number;
487
+ decodedLength: number;
488
+ position: number;
489
+ }
@@ -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
+ }
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Copyright (c) 2018 The xterm.js authors. All rights reserved.
3
+ * @license MIT
4
+ */
5
+
6
+ import { IAttributeData, IColorRGB, IExtendedAttrs } from 'common/Types';
7
+ import { Attributes, FgFlags, BgFlags, UnderlineStyle } from 'common/buffer/Constants';
8
+
9
+ export class AttributeData implements IAttributeData {
10
+ public static toColorRGB(value: number): IColorRGB {
11
+ return [
12
+ value >>> Attributes.RED_SHIFT & 255,
13
+ value >>> Attributes.GREEN_SHIFT & 255,
14
+ value & 255
15
+ ];
16
+ }
17
+
18
+ public static fromColorRGB(value: IColorRGB): number {
19
+ return (value[0] & 255) << Attributes.RED_SHIFT | (value[1] & 255) << Attributes.GREEN_SHIFT | value[2] & 255;
20
+ }
21
+
22
+ public clone(): IAttributeData {
23
+ const newObj = new AttributeData();
24
+ newObj.fg = this.fg;
25
+ newObj.bg = this.bg;
26
+ newObj.extended = this.extended.clone();
27
+ return newObj;
28
+ }
29
+
30
+ // data
31
+ public fg = 0;
32
+ public bg = 0;
33
+ public extended = new ExtendedAttrs();
34
+
35
+ // flags
36
+ public isInverse(): number { return this.fg & FgFlags.INVERSE; }
37
+ public isBold(): number { return this.fg & FgFlags.BOLD; }
38
+ public isUnderline(): number { return this.fg & FgFlags.UNDERLINE; }
39
+ public isBlink(): number { return this.fg & FgFlags.BLINK; }
40
+ public isInvisible(): number { return this.fg & FgFlags.INVISIBLE; }
41
+ public isItalic(): number { return this.bg & BgFlags.ITALIC; }
42
+ public isDim(): number { return this.bg & BgFlags.DIM; }
43
+ public isStrikethrough(): number { return this.fg & FgFlags.STRIKETHROUGH; }
44
+
45
+ // color modes
46
+ public getFgColorMode(): number { return this.fg & Attributes.CM_MASK; }
47
+ public getBgColorMode(): number { return this.bg & Attributes.CM_MASK; }
48
+ public isFgRGB(): boolean { return (this.fg & Attributes.CM_MASK) === Attributes.CM_RGB; }
49
+ public isBgRGB(): boolean { return (this.bg & Attributes.CM_MASK) === Attributes.CM_RGB; }
50
+ public isFgPalette(): boolean { return (this.fg & Attributes.CM_MASK) === Attributes.CM_P16 || (this.fg & Attributes.CM_MASK) === Attributes.CM_P256; }
51
+ public isBgPalette(): boolean { return (this.bg & Attributes.CM_MASK) === Attributes.CM_P16 || (this.bg & Attributes.CM_MASK) === Attributes.CM_P256; }
52
+ public isFgDefault(): boolean { return (this.fg & Attributes.CM_MASK) === 0; }
53
+ public isBgDefault(): boolean { return (this.bg & Attributes.CM_MASK) === 0; }
54
+ public isAttributeDefault(): boolean { return this.fg === 0 && this.bg === 0; }
55
+
56
+ // colors
57
+ public getFgColor(): number {
58
+ switch (this.fg & Attributes.CM_MASK) {
59
+ case Attributes.CM_P16:
60
+ case Attributes.CM_P256: return this.fg & Attributes.PCOLOR_MASK;
61
+ case Attributes.CM_RGB: return this.fg & Attributes.RGB_MASK;
62
+ default: return -1; // CM_DEFAULT defaults to -1
63
+ }
64
+ }
65
+ public getBgColor(): number {
66
+ switch (this.bg & Attributes.CM_MASK) {
67
+ case Attributes.CM_P16:
68
+ case Attributes.CM_P256: return this.bg & Attributes.PCOLOR_MASK;
69
+ case Attributes.CM_RGB: return this.bg & Attributes.RGB_MASK;
70
+ default: return -1; // CM_DEFAULT defaults to -1
71
+ }
72
+ }
73
+
74
+ // extended attrs
75
+ public hasExtendedAttrs(): number {
76
+ return this.bg & BgFlags.HAS_EXTENDED;
77
+ }
78
+ public updateExtended(): void {
79
+ if (this.extended.isEmpty()) {
80
+ this.bg &= ~BgFlags.HAS_EXTENDED;
81
+ } else {
82
+ this.bg |= BgFlags.HAS_EXTENDED;
83
+ }
84
+ }
85
+ public getUnderlineColor(): number {
86
+ if ((this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor) {
87
+ switch (this.extended.underlineColor & Attributes.CM_MASK) {
88
+ case Attributes.CM_P16:
89
+ case Attributes.CM_P256: return this.extended.underlineColor & Attributes.PCOLOR_MASK;
90
+ case Attributes.CM_RGB: return this.extended.underlineColor & Attributes.RGB_MASK;
91
+ default: return this.getFgColor();
92
+ }
93
+ }
94
+ return this.getFgColor();
95
+ }
96
+ public getUnderlineColorMode(): number {
97
+ return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor
98
+ ? this.extended.underlineColor & Attributes.CM_MASK
99
+ : this.getFgColorMode();
100
+ }
101
+ public isUnderlineColorRGB(): boolean {
102
+ return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor
103
+ ? (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_RGB
104
+ : this.isFgRGB();
105
+ }
106
+ public isUnderlineColorPalette(): boolean {
107
+ return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor
108
+ ? (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_P16
109
+ || (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_P256
110
+ : this.isFgPalette();
111
+ }
112
+ public isUnderlineColorDefault(): boolean {
113
+ return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor
114
+ ? (this.extended.underlineColor & Attributes.CM_MASK) === 0
115
+ : this.isFgDefault();
116
+ }
117
+ public getUnderlineStyle(): UnderlineStyle {
118
+ return this.fg & FgFlags.UNDERLINE
119
+ ? (this.bg & BgFlags.HAS_EXTENDED ? this.extended.underlineStyle : UnderlineStyle.SINGLE)
120
+ : UnderlineStyle.NONE;
121
+ }
122
+ }
123
+
124
+
125
+ /**
126
+ * Extended attributes for a cell.
127
+ * Holds information about different underline styles and color.
128
+ */
129
+ export class ExtendedAttrs implements IExtendedAttrs {
130
+ constructor(
131
+ // underline style, NONE is empty
132
+ public underlineStyle: UnderlineStyle = UnderlineStyle.NONE,
133
+ // underline color, -1 is empty (same as FG)
134
+ public underlineColor: number = -1
135
+ ) {}
136
+
137
+ public clone(): IExtendedAttrs {
138
+ return new ExtendedAttrs(this.underlineStyle, this.underlineColor);
139
+ }
140
+
141
+ /**
142
+ * Convenient method to indicate whether the object holds no additional information,
143
+ * that needs to be persistant in the buffer.
144
+ */
145
+ public isEmpty(): boolean {
146
+ return this.underlineStyle === UnderlineStyle.NONE;
147
+ }
148
+ }