@xterm/xterm 6.1.0-beta.26 → 6.1.0-beta.261

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 (179) hide show
  1. package/README.md +62 -38
  2. package/css/xterm.css +29 -22
  3. package/lib/xterm.js +1 -1
  4. package/lib/xterm.js.map +1 -1
  5. package/lib/xterm.mjs +8 -34
  6. package/lib/xterm.mjs.map +4 -4
  7. package/package.json +56 -48
  8. package/src/browser/AccessibilityManager.ts +18 -13
  9. package/src/browser/Clipboard.ts +8 -5
  10. package/src/browser/ColorContrastCache.ts +3 -3
  11. package/src/browser/CoreBrowserTerminal.ts +177 -346
  12. package/src/browser/Dom.ts +178 -0
  13. package/src/browser/Linkifier.ts +14 -14
  14. package/src/browser/OscLinkProvider.ts +86 -18
  15. package/src/browser/RenderDebouncer.ts +4 -4
  16. package/src/browser/TimeBasedDebouncer.ts +3 -3
  17. package/src/browser/Types.ts +16 -14
  18. package/src/browser/Viewport.ts +58 -23
  19. package/src/browser/decorations/BufferDecorationRenderer.ts +3 -3
  20. package/src/browser/decorations/ColorZoneStore.ts +1 -1
  21. package/src/browser/decorations/OverviewRulerRenderer.ts +36 -20
  22. package/src/browser/input/CompositionHelper.ts +47 -11
  23. package/src/browser/input/MoveToCell.ts +2 -2
  24. package/src/browser/public/Terminal.ts +33 -36
  25. package/src/browser/renderer/dom/DomRenderer.ts +251 -85
  26. package/src/browser/renderer/dom/DomRendererRowFactory.ts +34 -27
  27. package/src/browser/renderer/dom/WidthCache.ts +57 -55
  28. package/src/browser/renderer/shared/Constants.ts +7 -0
  29. package/src/browser/renderer/shared/RendererUtils.ts +1 -1
  30. package/src/browser/renderer/shared/SelectionRenderModel.ts +2 -2
  31. package/src/browser/renderer/shared/TextBlinkStateManager.ts +97 -0
  32. package/src/browser/renderer/shared/Types.ts +10 -4
  33. package/src/browser/scrollable/abstractScrollbar.ts +300 -0
  34. package/src/browser/scrollable/fastDomNode.ts +126 -0
  35. package/src/browser/scrollable/globalPointerMoveMonitor.ts +90 -0
  36. package/src/browser/scrollable/horizontalScrollbar.ts +85 -0
  37. package/src/browser/scrollable/mouseEvent.ts +292 -0
  38. package/src/browser/scrollable/scrollable.ts +486 -0
  39. package/src/browser/scrollable/scrollableElement.ts +581 -0
  40. package/src/browser/scrollable/scrollableElementOptions.ts +161 -0
  41. package/src/browser/scrollable/scrollbarArrow.ts +110 -0
  42. package/src/browser/scrollable/scrollbarState.ts +246 -0
  43. package/src/browser/scrollable/scrollbarVisibilityController.ts +113 -0
  44. package/src/browser/scrollable/touch.ts +485 -0
  45. package/src/browser/scrollable/verticalScrollbar.ts +143 -0
  46. package/src/browser/scrollable/widget.ts +23 -0
  47. package/src/browser/selection/SelectionModel.ts +1 -1
  48. package/src/browser/services/CharSizeService.ts +4 -4
  49. package/src/browser/services/CharacterJoinerService.ts +7 -7
  50. package/src/browser/services/CoreBrowserService.ts +7 -5
  51. package/src/browser/services/KeyboardService.ts +67 -0
  52. package/src/browser/services/LinkProviderService.ts +3 -3
  53. package/src/browser/services/MouseCoordsService.ts +47 -0
  54. package/src/browser/services/MouseService.ts +619 -23
  55. package/src/browser/services/RenderService.ts +33 -21
  56. package/src/browser/services/SelectionService.ts +72 -54
  57. package/src/browser/services/Services.ts +44 -21
  58. package/src/browser/services/ThemeService.ts +8 -8
  59. package/src/common/Async.ts +141 -0
  60. package/src/common/CircularList.ts +24 -3
  61. package/src/common/Color.ts +9 -1
  62. package/src/common/CoreTerminal.ts +61 -35
  63. package/src/common/Event.ts +118 -0
  64. package/src/common/InputHandler.ts +301 -102
  65. package/src/common/Lifecycle.ts +113 -0
  66. package/src/common/Platform.ts +13 -3
  67. package/src/common/SortedList.ts +8 -4
  68. package/src/common/StringBuilder.ts +67 -0
  69. package/src/common/TaskQueue.ts +16 -7
  70. package/src/common/Types.ts +67 -205
  71. package/src/common/Version.ts +9 -0
  72. package/src/common/WindowsMode.ts +2 -2
  73. package/src/common/buffer/AttributeData.ts +3 -2
  74. package/src/common/buffer/Buffer.ts +45 -30
  75. package/src/common/buffer/BufferLine.ts +145 -73
  76. package/src/common/buffer/BufferLineStringCache.ts +69 -0
  77. package/src/common/buffer/BufferReflow.ts +7 -4
  78. package/src/common/buffer/BufferSet.ts +13 -9
  79. package/src/common/buffer/CellData.ts +61 -4
  80. package/src/common/buffer/Marker.ts +3 -3
  81. package/src/common/buffer/Types.ts +153 -3
  82. package/src/common/data/Charsets.ts +4 -7
  83. package/src/common/data/EscapeSequences.ts +71 -70
  84. package/src/common/input/Keyboard.ts +16 -9
  85. package/src/common/input/KittyKeyboard.ts +526 -0
  86. package/src/common/input/TextDecoder.ts +1 -1
  87. package/src/common/input/UnicodeV6.ts +3 -2
  88. package/src/common/input/Win32InputMode.ts +297 -0
  89. package/src/common/input/WriteBuffer.ts +107 -38
  90. package/src/common/input/XParseColor.ts +2 -2
  91. package/src/common/parser/ApcParser.ts +196 -0
  92. package/src/common/parser/Constants.ts +14 -4
  93. package/src/common/parser/DcsParser.ts +15 -16
  94. package/src/common/parser/EscapeSequenceParser.ts +212 -70
  95. package/src/common/parser/OscParser.ts +14 -15
  96. package/src/common/parser/Params.ts +28 -9
  97. package/src/common/parser/Types.ts +38 -28
  98. package/src/common/public/BufferApiView.ts +3 -3
  99. package/src/common/public/BufferLineApiView.ts +4 -4
  100. package/src/common/public/BufferNamespaceApi.ts +5 -5
  101. package/src/common/public/ParserApi.ts +5 -2
  102. package/src/common/public/UnicodeApi.ts +1 -1
  103. package/src/common/services/BufferService.ts +17 -13
  104. package/src/common/services/CharsetService.ts +6 -2
  105. package/src/common/services/CoreService.ts +23 -10
  106. package/src/common/services/DecorationService.ts +260 -15
  107. package/src/common/services/InstantiationService.ts +2 -2
  108. package/src/common/services/LogService.ts +2 -32
  109. package/src/common/services/{CoreMouseService.ts → MouseStateService.ts} +22 -133
  110. package/src/common/services/OptionsService.ts +17 -7
  111. package/src/common/services/OscLinkService.ts +3 -2
  112. package/src/common/services/ServiceRegistry.ts +14 -8
  113. package/src/common/services/Services.ts +52 -48
  114. package/src/common/services/UnicodeService.ts +6 -11
  115. package/typings/xterm.d.ts +329 -34
  116. package/src/common/Clone.ts +0 -23
  117. package/src/common/TypedArrayUtils.ts +0 -17
  118. package/src/vs/base/browser/browser.ts +0 -141
  119. package/src/vs/base/browser/canIUse.ts +0 -49
  120. package/src/vs/base/browser/dom.ts +0 -2369
  121. package/src/vs/base/browser/fastDomNode.ts +0 -316
  122. package/src/vs/base/browser/globalPointerMoveMonitor.ts +0 -112
  123. package/src/vs/base/browser/iframe.ts +0 -135
  124. package/src/vs/base/browser/keyboardEvent.ts +0 -213
  125. package/src/vs/base/browser/mouseEvent.ts +0 -229
  126. package/src/vs/base/browser/touch.ts +0 -372
  127. package/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +0 -303
  128. package/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +0 -114
  129. package/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +0 -720
  130. package/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +0 -165
  131. package/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +0 -114
  132. package/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +0 -243
  133. package/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts +0 -118
  134. package/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +0 -116
  135. package/src/vs/base/browser/ui/widget.ts +0 -57
  136. package/src/vs/base/browser/window.ts +0 -14
  137. package/src/vs/base/common/arrays.ts +0 -887
  138. package/src/vs/base/common/arraysFind.ts +0 -202
  139. package/src/vs/base/common/assert.ts +0 -71
  140. package/src/vs/base/common/async.ts +0 -1992
  141. package/src/vs/base/common/cancellation.ts +0 -148
  142. package/src/vs/base/common/charCode.ts +0 -450
  143. package/src/vs/base/common/collections.ts +0 -140
  144. package/src/vs/base/common/decorators.ts +0 -130
  145. package/src/vs/base/common/equals.ts +0 -146
  146. package/src/vs/base/common/errors.ts +0 -303
  147. package/src/vs/base/common/event.ts +0 -1778
  148. package/src/vs/base/common/functional.ts +0 -32
  149. package/src/vs/base/common/hash.ts +0 -316
  150. package/src/vs/base/common/iterator.ts +0 -159
  151. package/src/vs/base/common/keyCodes.ts +0 -526
  152. package/src/vs/base/common/keybindings.ts +0 -284
  153. package/src/vs/base/common/lazy.ts +0 -47
  154. package/src/vs/base/common/lifecycle.ts +0 -801
  155. package/src/vs/base/common/linkedList.ts +0 -142
  156. package/src/vs/base/common/map.ts +0 -202
  157. package/src/vs/base/common/numbers.ts +0 -98
  158. package/src/vs/base/common/observable.ts +0 -76
  159. package/src/vs/base/common/observableInternal/api.ts +0 -31
  160. package/src/vs/base/common/observableInternal/autorun.ts +0 -281
  161. package/src/vs/base/common/observableInternal/base.ts +0 -489
  162. package/src/vs/base/common/observableInternal/debugName.ts +0 -145
  163. package/src/vs/base/common/observableInternal/derived.ts +0 -428
  164. package/src/vs/base/common/observableInternal/lazyObservableValue.ts +0 -146
  165. package/src/vs/base/common/observableInternal/logging.ts +0 -328
  166. package/src/vs/base/common/observableInternal/promise.ts +0 -209
  167. package/src/vs/base/common/observableInternal/utils.ts +0 -610
  168. package/src/vs/base/common/platform.ts +0 -281
  169. package/src/vs/base/common/scrollable.ts +0 -522
  170. package/src/vs/base/common/sequence.ts +0 -34
  171. package/src/vs/base/common/stopwatch.ts +0 -43
  172. package/src/vs/base/common/strings.ts +0 -557
  173. package/src/vs/base/common/symbols.ts +0 -9
  174. package/src/vs/base/common/uint.ts +0 -59
  175. package/src/vs/patches/nls.ts +0 -90
  176. package/src/vs/typings/base-common.d.ts +0 -20
  177. package/src/vs/typings/require.d.ts +0 -42
  178. package/src/vs/typings/vscode-globals-nls.d.ts +0 -36
  179. package/src/vs/typings/vscode-globals-product.d.ts +0 -33
@@ -3,10 +3,11 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { CharData, ICellData, IExtendedAttrs } from 'common/Types';
7
- import { stringFromCodePoint } from 'common/input/TextDecoder';
8
- import { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from 'common/buffer/Constants';
9
- import { AttributeData, ExtendedAttrs } from 'common/buffer/AttributeData';
6
+ import { CharData, ICellData, IExtendedAttrs } from './Types';
7
+ import { stringFromCodePoint } from '../input/TextDecoder';
8
+ import { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from './Constants';
9
+ import { AttributeData, ExtendedAttrs } from './AttributeData';
10
+ import type { IBufferCell as IBufferCellApi } from '@xterm/xterm';
10
11
 
11
12
  /**
12
13
  * CellData - represents a single Cell in the terminal buffer.
@@ -91,4 +92,60 @@ export class CellData extends AttributeData implements ICellData {
91
92
  public getAsCharData(): CharData {
92
93
  return [this.fg, this.getChars(), this.getWidth(), this.getCode()];
93
94
  }
95
+
96
+ public attributesEquals(other: IBufferCellApi): boolean {
97
+ if (this.getFgColorMode() !== other.getFgColorMode() || this.getFgColor() !== other.getFgColor()) {
98
+ return false;
99
+ }
100
+ if (this.getBgColorMode() !== other.getBgColorMode() || this.getBgColor() !== other.getBgColor()) {
101
+ return false;
102
+ }
103
+ if (this.isInverse() !== other.isInverse()) {
104
+ return false;
105
+ }
106
+ if (this.isBold() !== other.isBold()) {
107
+ return false;
108
+ }
109
+ if (this.isUnderline() !== other.isUnderline()) {
110
+ return false;
111
+ }
112
+ if (this.isUnderline()) {
113
+ if (this.getUnderlineStyle() !== other.getUnderlineStyle()) {
114
+ return false;
115
+ }
116
+ const thisDefault = this.isUnderlineColorDefault();
117
+ const otherDefault = other.isUnderlineColorDefault();
118
+ if (!(thisDefault && otherDefault)) {
119
+ if (thisDefault !== otherDefault) {
120
+ return false;
121
+ }
122
+ if (this.getUnderlineColor() !== other.getUnderlineColor()) {
123
+ return false;
124
+ }
125
+ if (this.getUnderlineColorMode() !== other.getUnderlineColorMode()) {
126
+ return false;
127
+ }
128
+ }
129
+ }
130
+ if (this.isOverline() !== other.isOverline()) {
131
+ return false;
132
+ }
133
+ if (this.isBlink() !== other.isBlink()) {
134
+ return false;
135
+ }
136
+ if (this.isInvisible() !== other.isInvisible()) {
137
+ return false;
138
+ }
139
+ if (this.isItalic() !== other.isItalic()) {
140
+ return false;
141
+ }
142
+ if (this.isDim() !== other.isDim()) {
143
+ return false;
144
+ }
145
+ if (this.isStrikethrough() !== other.isStrikethrough()) {
146
+ return false;
147
+ }
148
+ return true;
149
+ }
150
+
94
151
  }
@@ -3,9 +3,9 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { IDisposable, IMarker } from 'common/Types';
7
- import { Emitter } from 'vs/base/common/event';
8
- import { dispose } from 'vs/base/common/lifecycle';
6
+ import { dispose, IDisposable } from '../Lifecycle';
7
+ import { IMarker } from './Types';
8
+ import { Emitter } from '../Event';
9
9
 
10
10
  export class Marker implements IMarker {
11
11
  private static _nextId = 1;
@@ -3,12 +3,158 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { IAttributeData, ICircularList, IBufferLine, ICellData, IMarker, ICharset, IDisposable } from 'common/Types';
7
- import type { Event } from 'vs/base/common/event';
6
+ import type { IEvent } from '../Event';
7
+ import type { ICircularList } from '../CircularList';
8
+ import type { ICharset } from '../Types';
9
+ import type { IDisposable } from '../Lifecycle';
10
+ import type { UnderlineStyle } from './Constants';
8
11
 
9
12
  // BufferIndex denotes a position in the buffer: [rowIndex, colIndex]
10
13
  export type BufferIndex = [number, number];
11
14
 
15
+ export type CharData = [attr: number, char: string, width: number, code: number];
16
+
17
+ export interface IExtendedAttrs {
18
+ ext: number;
19
+ underlineStyle: UnderlineStyle;
20
+ underlineColor: number;
21
+ underlineVariantOffset: number;
22
+ urlId: number;
23
+ clone(): IExtendedAttrs;
24
+ isEmpty(): boolean;
25
+ }
26
+
27
+ /**
28
+ * An object that represents all attributes of a cell.
29
+ */
30
+ export interface IAttributeData {
31
+ /**
32
+ * "fg" is a 32-bit unsigned integer that stores the foreground color of the cell in the 24 least
33
+ * significant bits and additional flags in the remaining 8 bits.
34
+ */
35
+ fg: number;
36
+ /**
37
+ * "bg" is a 32-bit unsigned integer that stores the background color of the cell in the 24 least
38
+ * significant bits and additional flags in the remaining 8 bits.
39
+ */
40
+ bg: number;
41
+ /**
42
+ * "extended", aka "ext", stores extended attributes beyond those available in fg and bg. This
43
+ * data is optional on a cell and encodes less common data.
44
+ */
45
+ extended: IExtendedAttrs;
46
+
47
+ clone(): IAttributeData;
48
+
49
+ // flags
50
+ isInverse(): number;
51
+ isBold(): number;
52
+ isUnderline(): number;
53
+ isBlink(): number;
54
+ isInvisible(): number;
55
+ isItalic(): number;
56
+ isDim(): number;
57
+ isStrikethrough(): number;
58
+ isProtected(): number;
59
+ isOverline(): number;
60
+
61
+ /**
62
+ * The color mode of the foreground color which determines how to decode {@link getFgColor},
63
+ * possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
64
+ * {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
65
+ */
66
+ getFgColorMode(): number;
67
+ /**
68
+ * The color mode of the background color which determines how to decode {@link getBgColor},
69
+ * possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
70
+ * {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
71
+ */
72
+ getBgColorMode(): number;
73
+ isFgRGB(): boolean;
74
+ isBgRGB(): boolean;
75
+ isFgPalette(): boolean;
76
+ isBgPalette(): boolean;
77
+ isFgDefault(): boolean;
78
+ isBgDefault(): boolean;
79
+ isAttributeDefault(): boolean;
80
+
81
+ /**
82
+ * Gets an integer representation of the foreground color, how to decode the color depends on the
83
+ * color mode {@link getFgColorMode}.
84
+ */
85
+ getFgColor(): number;
86
+ /**
87
+ * Gets an integer representation of the background color, how to decode the color depends on the
88
+ * color mode {@link getBgColorMode}.
89
+ */
90
+ getBgColor(): number;
91
+
92
+ // extended attrs
93
+ hasExtendedAttrs(): number;
94
+ updateExtended(): void;
95
+ getUnderlineColor(): number;
96
+ getUnderlineColorMode(): number;
97
+ isUnderlineColorRGB(): boolean;
98
+ isUnderlineColorPalette(): boolean;
99
+ isUnderlineColorDefault(): boolean;
100
+ getUnderlineStyle(): number;
101
+ getUnderlineVariantOffset(): number;
102
+ }
103
+
104
+ /** Cell data */
105
+ export interface ICellData extends IAttributeData {
106
+ content: number;
107
+ combinedData: string;
108
+ isCombined(): number;
109
+ getWidth(): number;
110
+ getChars(): string;
111
+ getCode(): number;
112
+ setFromCharData(value: CharData): void;
113
+ getAsCharData(): CharData;
114
+ }
115
+
116
+ /**
117
+ * Interface for a line in the terminal buffer.
118
+ */
119
+ export interface IBufferLine {
120
+ length: number;
121
+ isWrapped: boolean;
122
+ get(index: number): CharData;
123
+ set(index: number, value: CharData): void;
124
+ loadCell(index: number, cell: ICellData): ICellData;
125
+ setCell(index: number, cell: ICellData): void;
126
+ setCellFromCodepoint(index: number, codePoint: number, width: number, attrs: IAttributeData): void;
127
+ addCodepointToCell(index: number, codePoint: number, width: number): void;
128
+ insertCells(pos: number, n: number, ch: ICellData): void;
129
+ deleteCells(pos: number, n: number, fill: ICellData): void;
130
+ replaceCells(start: number, end: number, fill: ICellData, respectProtect?: boolean): void;
131
+ resize(cols: number, fill: ICellData): boolean;
132
+ cleanupMemory(): number;
133
+ fill(fillCellData: ICellData, respectProtect?: boolean): void;
134
+ copyFrom(line: IBufferLine): void;
135
+ clone(): IBufferLine;
136
+ getTrimmedLength(): number;
137
+ getNoBgTrimmedLength(): number;
138
+ translateToString(trimRight?: boolean, startCol?: number, endCol?: number, outColumns?: number[]): string;
139
+
140
+ /* direct access to cell attrs */
141
+ getWidth(index: number): number;
142
+ hasWidth(index: number): number;
143
+ getFg(index: number): number;
144
+ getBg(index: number): number;
145
+ hasContent(index: number): number;
146
+ getCodePoint(index: number): number;
147
+ isCombined(index: number): number;
148
+ getString(index: number): string;
149
+ }
150
+
151
+ export interface IMarker extends IDisposable {
152
+ readonly id: number;
153
+ readonly isDisposed: boolean;
154
+ readonly line: number;
155
+ onDispose: IEvent<void>;
156
+ }
157
+
12
158
  export interface IBuffer {
13
159
  readonly lines: ICircularList<IBufferLine>;
14
160
  ydisp: number;
@@ -22,6 +168,10 @@ export interface IBuffer {
22
168
  savedY: number;
23
169
  savedX: number;
24
170
  savedCharset: ICharset | undefined;
171
+ savedCharsets: (ICharset | undefined)[];
172
+ savedGlevel: number;
173
+ savedOriginMode: boolean;
174
+ savedWraparoundMode: boolean;
25
175
  savedCurAttrData: IAttributeData;
26
176
  isCursorInViewport: boolean;
27
177
  markers: IMarker[];
@@ -42,7 +192,7 @@ export interface IBufferSet extends IDisposable {
42
192
  normal: IBuffer;
43
193
  active: IBuffer;
44
194
 
45
- onBufferActivate: Event<{ activeBuffer: IBuffer, inactiveBuffer: IBuffer }>;
195
+ onBufferActivate: IEvent<{ activeBuffer: IBuffer, inactiveBuffer: IBuffer }>;
46
196
 
47
197
  activateNormalBuffer(): void;
48
198
  activateAltBuffer(fillAttr?: IAttributeData): void;
@@ -3,7 +3,7 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { ICharset } from 'common/Types';
6
+ import { ICharset } from '../Types';
7
7
 
8
8
  /**
9
9
  * The character sets supported by the terminal. These enable several languages
@@ -98,8 +98,7 @@ CHARSETS['4'] = {
98
98
  * ESC (C or ESC (5
99
99
  * Reference: http://vt100.net/docs/vt220-rm/table2-7.html
100
100
  */
101
- CHARSETS['C'] =
102
- CHARSETS['5'] = {
101
+ CHARSETS['C'] = CHARSETS['5'] = {
103
102
  '[': 'Ä',
104
103
  '\\': 'Ö',
105
104
  ']': 'Å',
@@ -185,8 +184,7 @@ CHARSETS['Y'] = {
185
184
  * ESC (E or ESC (6
186
185
  * Reference: http://vt100.net/docs/vt220-rm/table2-12.html
187
186
  */
188
- CHARSETS['E'] =
189
- CHARSETS['6'] = {
187
+ CHARSETS['E'] = CHARSETS['6'] = {
190
188
  '@': 'Ä',
191
189
  '[': 'Æ',
192
190
  '\\': 'Ø',
@@ -220,8 +218,7 @@ CHARSETS['Z'] = {
220
218
  * ESC (H or ESC (7
221
219
  * Reference: http://vt100.net/docs/vt220-rm/table2-14.html
222
220
  */
223
- CHARSETS['H'] =
224
- CHARSETS['7'] = {
221
+ CHARSETS['H'] = CHARSETS['7'] = {
225
222
  '@': 'É',
226
223
  '[': 'Ä',
227
224
  '\\': 'Ö',
@@ -7,147 +7,148 @@
7
7
  * C0 control codes
8
8
  * See = https://en.wikipedia.org/wiki/C0_and_C1_control_codes
9
9
  */
10
- export namespace C0 {
10
+ export const enum C0 {
11
11
  /** Null (Caret = ^@, C = \0) */
12
- export const NUL = '\x00';
12
+ NUL = '\x00',
13
13
  /** Start of Heading (Caret = ^A) */
14
- export const SOH = '\x01';
14
+ SOH = '\x01',
15
15
  /** Start of Text (Caret = ^B) */
16
- export const STX = '\x02';
16
+ STX = '\x02',
17
17
  /** End of Text (Caret = ^C) */
18
- export const ETX = '\x03';
18
+ ETX = '\x03',
19
19
  /** End of Transmission (Caret = ^D) */
20
- export const EOT = '\x04';
20
+ EOT = '\x04',
21
21
  /** Enquiry (Caret = ^E) */
22
- export const ENQ = '\x05';
22
+ ENQ = '\x05',
23
23
  /** Acknowledge (Caret = ^F) */
24
- export const ACK = '\x06';
24
+ ACK = '\x06',
25
25
  /** Bell (Caret = ^G, C = \a) */
26
- export const BEL = '\x07';
26
+ BEL = '\x07',
27
27
  /** Backspace (Caret = ^H, C = \b) */
28
- export const BS = '\x08';
28
+ BS = '\x08',
29
29
  /** Character Tabulation, Horizontal Tabulation (Caret = ^I, C = \t) */
30
- export const HT = '\x09';
30
+ HT = '\x09',
31
31
  /** Line Feed (Caret = ^J, C = \n) */
32
- export const LF = '\x0a';
32
+ LF = '\x0a',
33
33
  /** Line Tabulation, Vertical Tabulation (Caret = ^K, C = \v) */
34
- export const VT = '\x0b';
34
+ VT = '\x0b',
35
35
  /** Form Feed (Caret = ^L, C = \f) */
36
- export const FF = '\x0c';
36
+ FF = '\x0c',
37
37
  /** Carriage Return (Caret = ^M, C = \r) */
38
- export const CR = '\x0d';
38
+ CR = '\x0d',
39
39
  /** Shift Out (Caret = ^N) */
40
- export const SO = '\x0e';
40
+ SO = '\x0e',
41
41
  /** Shift In (Caret = ^O) */
42
- export const SI = '\x0f';
42
+ SI = '\x0f',
43
43
  /** Data Link Escape (Caret = ^P) */
44
- export const DLE = '\x10';
44
+ DLE = '\x10',
45
45
  /** Device Control One (XON) (Caret = ^Q) */
46
- export const DC1 = '\x11';
46
+ DC1 = '\x11',
47
47
  /** Device Control Two (Caret = ^R) */
48
- export const DC2 = '\x12';
48
+ DC2 = '\x12',
49
49
  /** Device Control Three (XOFF) (Caret = ^S) */
50
- export const DC3 = '\x13';
50
+ DC3 = '\x13',
51
51
  /** Device Control Four (Caret = ^T) */
52
- export const DC4 = '\x14';
52
+ DC4 = '\x14',
53
53
  /** Negative Acknowledge (Caret = ^U) */
54
- export const NAK = '\x15';
54
+ NAK = '\x15',
55
55
  /** Synchronous Idle (Caret = ^V) */
56
- export const SYN = '\x16';
56
+ SYN = '\x16',
57
57
  /** End of Transmission Block (Caret = ^W) */
58
- export const ETB = '\x17';
58
+ ETB = '\x17',
59
59
  /** Cancel (Caret = ^X) */
60
- export const CAN = '\x18';
60
+ CAN = '\x18',
61
61
  /** End of Medium (Caret = ^Y) */
62
- export const EM = '\x19';
62
+ EM = '\x19',
63
63
  /** Substitute (Caret = ^Z) */
64
- export const SUB = '\x1a';
64
+ SUB = '\x1a',
65
65
  /** Escape (Caret = ^[, C = \e) */
66
- export const ESC = '\x1b';
66
+ ESC = '\x1b',
67
67
  /** File Separator (Caret = ^\) */
68
- export const FS = '\x1c';
68
+ FS = '\x1c',
69
69
  /** Group Separator (Caret = ^]) */
70
- export const GS = '\x1d';
70
+ GS = '\x1d',
71
71
  /** Record Separator (Caret = ^^) */
72
- export const RS = '\x1e';
72
+ RS = '\x1e',
73
73
  /** Unit Separator (Caret = ^_) */
74
- export const US = '\x1f';
74
+ US = '\x1f',
75
75
  /** Space */
76
- export const SP = '\x20';
76
+ SP = '\x20',
77
77
  /** Delete (Caret = ^?) */
78
- export const DEL = '\x7f';
78
+ DEL = '\x7f'
79
79
  }
80
80
 
81
81
  /**
82
82
  * C1 control codes
83
83
  * See = https://en.wikipedia.org/wiki/C0_and_C1_control_codes
84
84
  */
85
- export namespace C1 {
85
+ export const enum C1 {
86
86
  /** padding character */
87
- export const PAD = '\x80';
87
+ PAD = '\x80',
88
88
  /** High Octet Preset */
89
- export const HOP = '\x81';
89
+ HOP = '\x81',
90
90
  /** Break Permitted Here */
91
- export const BPH = '\x82';
91
+ BPH = '\x82',
92
92
  /** No Break Here */
93
- export const NBH = '\x83';
93
+ NBH = '\x83',
94
94
  /** Index */
95
- export const IND = '\x84';
95
+ IND = '\x84',
96
96
  /** Next Line */
97
- export const NEL = '\x85';
97
+ NEL = '\x85',
98
98
  /** Start of Selected Area */
99
- export const SSA = '\x86';
99
+ SSA = '\x86',
100
100
  /** End of Selected Area */
101
- export const ESA = '\x87';
101
+ ESA = '\x87',
102
102
  /** Horizontal Tabulation Set */
103
- export const HTS = '\x88';
103
+ HTS = '\x88',
104
104
  /** Horizontal Tabulation With Justification */
105
- export const HTJ = '\x89';
105
+ HTJ = '\x89',
106
106
  /** Vertical Tabulation Set */
107
- export const VTS = '\x8a';
107
+ VTS = '\x8a',
108
108
  /** Partial Line Down */
109
- export const PLD = '\x8b';
109
+ PLD = '\x8b',
110
110
  /** Partial Line Up */
111
- export const PLU = '\x8c';
111
+ PLU = '\x8c',
112
112
  /** Reverse Index */
113
- export const RI = '\x8d';
113
+ RI = '\x8d',
114
114
  /** Single-Shift 2 */
115
- export const SS2 = '\x8e';
115
+ SS2 = '\x8e',
116
116
  /** Single-Shift 3 */
117
- export const SS3 = '\x8f';
117
+ SS3 = '\x8f',
118
118
  /** Device Control String */
119
- export const DCS = '\x90';
119
+ DCS = '\x90',
120
120
  /** Private Use 1 */
121
- export const PU1 = '\x91';
121
+ PU1 = '\x91',
122
122
  /** Private Use 2 */
123
- export const PU2 = '\x92';
123
+ PU2 = '\x92',
124
124
  /** Set Transmit State */
125
- export const STS = '\x93';
125
+ STS = '\x93',
126
126
  /** Destructive backspace, intended to eliminate ambiguity about meaning of BS. */
127
- export const CCH = '\x94';
127
+ CCH = '\x94',
128
128
  /** Message Waiting */
129
- export const MW = '\x95';
129
+ MW = '\x95',
130
130
  /** Start of Protected Area */
131
- export const SPA = '\x96';
131
+ SPA = '\x96',
132
132
  /** End of Protected Area */
133
- export const EPA = '\x97';
133
+ EPA = '\x97',
134
134
  /** Start of String */
135
- export const SOS = '\x98';
135
+ SOS = '\x98',
136
136
  /** Single Graphic Character Introducer */
137
- export const SGCI = '\x99';
137
+ SGCI = '\x99',
138
138
  /** Single Character Introducer */
139
- export const SCI = '\x9a';
139
+ SCI = '\x9a',
140
140
  /** Control Sequence Introducer */
141
- export const CSI = '\x9b';
141
+ CSI = '\x9b',
142
142
  /** String Terminator */
143
- export const ST = '\x9c';
143
+ ST = '\x9c',
144
144
  /** Operating System Command */
145
- export const OSC = '\x9d';
145
+ OSC = '\x9d',
146
146
  /** Privacy Message */
147
- export const PM = '\x9e';
147
+ PM = '\x9e',
148
148
  /** Application Program Command */
149
- export const APC = '\x9f';
149
+ APC = '\x9f'
150
150
  }
151
- export namespace C1_ESCAPED {
152
- export const ST = `${C0.ESC}\\`;
151
+
152
+ export const enum C1ESCAPED {
153
+ ST = '\x1b\\'
153
154
  }
@@ -4,8 +4,8 @@
4
4
  * @license MIT
5
5
  */
6
6
 
7
- import { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/Types';
8
- import { C0 } from 'common/data/EscapeSequences';
7
+ import { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from '../Types';
8
+ import { C0 } from '../data/EscapeSequences';
9
9
 
10
10
  // reg + shift key mappings for digits and special chars
11
11
  const KEYCODE_KEY_MAPPINGS: { [key: number]: [string, string]} = {
@@ -99,7 +99,13 @@ export function evaluateKeyboardEvent(
99
99
  break;
100
100
  case 13:
101
101
  // return/enter
102
- result.key = ev.altKey ? C0.ESC + C0.CR : C0.CR;
102
+ if (ev.key === 'c' && ev.ctrlKey) {
103
+ // HACK: Safari on iPad, iOS, AppleVisionPro sends key 13 when typing ctrl-c on hardware
104
+ // keyboard
105
+ result.key = C0.ETX;
106
+ } else {
107
+ result.key = ev.altKey ? C0.ESC + C0.CR : C0.CR;
108
+ }
103
109
  result.cancel = true;
104
110
  break;
105
111
  case 27:
@@ -315,6 +321,8 @@ export function evaluateKeyboardEvent(
315
321
  result.key = String.fromCharCode(ev.keyCode - 51 + 27);
316
322
  } else if (ev.keyCode === 56) {
317
323
  result.key = C0.DEL;
324
+ } else if (ev.key === '/') {
325
+ result.key = C0.US; // https://github.com/xtermjs/xterm.js/issues/5457
318
326
  } else if (ev.keyCode === 219) {
319
327
  result.key = C0.ESC;
320
328
  } else if (ev.keyCode === 220) {
@@ -358,12 +366,11 @@ export function evaluateKeyboardEvent(
358
366
  // Include only keys that that result in a _single_ character; don't include num lock,
359
367
  // volume up, etc.
360
368
  result.key = ev.key;
361
- } else if (ev.key && ev.ctrlKey) {
362
- if (ev.key === '_') { // ^_
363
- result.key = C0.US;
364
- }
365
- if (ev.key === '@') { // ^ + shift + 2 = ^ + @
366
- result.key = C0.NUL;
369
+ } else if (ev.key && ev.ctrlKey && ev.shiftKey) {
370
+ switch (ev.code) {
371
+ case 'Minus': result.key = C0.US; break; // ^_ (Ctrl+Shift+-_
372
+ case 'Digit2': result.key = C0.NUL; break; // ^@ (Ctrl+Shift+2)
373
+ case 'Digit6': result.key = C0.RS; break; // ^^ (Ctrl+Shift+6)
367
374
  }
368
375
  }
369
376
  break;