@xterm/xterm 6.1.0-beta.260 → 6.1.0-beta.262

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 (40) hide show
  1. package/lib/xterm.js +1 -1
  2. package/lib/xterm.js.map +1 -1
  3. package/lib/xterm.mjs +7 -7
  4. package/lib/xterm.mjs.map +4 -4
  5. package/package.json +2 -2
  6. package/src/browser/OscLinkProvider.ts +1 -1
  7. package/src/browser/Types.ts +3 -2
  8. package/src/browser/input/Mouse.ts +3 -3
  9. package/src/browser/renderer/dom/DomRendererRowFactory.ts +2 -1
  10. package/src/browser/scrollable/mouseEvent.ts +1 -1
  11. package/src/browser/services/CharacterJoinerService.ts +1 -1
  12. package/src/browser/services/SelectionService.ts +2 -2
  13. package/src/common/CircularList.ts +23 -2
  14. package/src/common/Color.ts +3 -3
  15. package/src/common/CoreTerminal.ts +20 -4
  16. package/src/common/InputHandler.ts +4 -4
  17. package/src/common/Platform.ts +1 -1
  18. package/src/common/Types.ts +25 -183
  19. package/src/common/Version.ts +1 -1
  20. package/src/common/buffer/AttributeData.ts +2 -1
  21. package/src/common/buffer/Buffer.ts +2 -2
  22. package/src/common/buffer/BufferLine.ts +1 -1
  23. package/src/common/buffer/BufferReflow.ts +1 -1
  24. package/src/common/buffer/BufferSet.ts +1 -2
  25. package/src/common/buffer/CellData.ts +1 -1
  26. package/src/common/buffer/Marker.ts +2 -2
  27. package/src/common/buffer/Types.ts +147 -1
  28. package/src/common/input/UnicodeV6.ts +1 -0
  29. package/src/common/parser/Types.ts +2 -26
  30. package/src/common/public/BufferLineApiView.ts +1 -1
  31. package/src/common/public/BufferNamespaceApi.ts +1 -1
  32. package/src/common/public/ParserApi.ts +1 -1
  33. package/src/common/public/UnicodeApi.ts +1 -1
  34. package/src/common/services/BufferService.ts +1 -2
  35. package/src/common/services/DecorationService.ts +2 -2
  36. package/src/common/services/InstantiationService.ts +2 -2
  37. package/src/common/services/OscLinkService.ts +2 -1
  38. package/src/common/services/ServiceRegistry.ts +5 -1
  39. package/src/common/services/Services.ts +3 -9
  40. package/src/common/services/UnicodeService.ts +4 -9
@@ -3,12 +3,158 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { IAttributeData, ICircularList, IBufferLine, ICellData, IMarker, ICharset, IDisposable } from '../Types';
7
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;
@@ -132,6 +132,7 @@ export class UnicodeV6 implements IUnicodeVersionProvider {
132
132
  public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {
133
133
  let width = this.wcwidth(codepoint);
134
134
  let shouldJoin = width === 0 && preceding !== 0;
135
+ // HACK: Ideally this file would not depend on the service which uses it
135
136
  if (shouldJoin) {
136
137
  const oldWidth = UnicodeService.extractWidth(preceding);
137
138
  if (oldWidth === 0) {
@@ -3,12 +3,10 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { IDisposable } from '../Types';
6
+ import { IDisposable, IParams, ParamsArray } from '../Types';
7
7
  import { ParserState } from './Constants';
8
8
 
9
-
10
- /** sequence params serialized to js arrays */
11
- export type ParamsArray = (number | number[])[];
9
+ export type { IParams, ParamsArray };
12
10
 
13
11
  /** Params constructor type. */
14
12
  export interface IParamsConstructor {
@@ -18,28 +16,6 @@ export interface IParamsConstructor {
18
16
  fromArray(values: ParamsArray): IParams;
19
17
  }
20
18
 
21
- /** Interface of Params storage class. */
22
- export interface IParams {
23
- /** from ctor */
24
- maxLength: number;
25
- maxSubParamsLength: number;
26
-
27
- /** param values and its length */
28
- params: Int32Array;
29
- length: number;
30
-
31
- /** methods */
32
- clone(): IParams;
33
- toArray(): ParamsArray;
34
- reset(): void;
35
- resetZdm(): void;
36
- addParam(value: number): void;
37
- addSubParam(value: number): void;
38
- hasSubParams(idx: number): boolean;
39
- getSubParams(idx: number): Int32Array | null;
40
- getSubParamsAll(): {[idx: number]: Int32Array};
41
- }
42
-
43
19
  /**
44
20
  * Internal state of EscapeSequenceParser.
45
21
  * Used as argument of the error handler to allow
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { CellData } from '../buffer/CellData';
7
- import { IBufferLine, ICellData } from '../Types';
7
+ import { IBufferLine, ICellData } from '../buffer/Types';
8
8
  import { IBufferCell as IBufferCellApi, IBufferLine as IBufferLineApi } from '@xterm/xterm';
9
9
 
10
10
  export class BufferLineApiView implements IBufferLineApi {
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from '@xterm/xterm';
7
7
  import { BufferApiView } from './BufferApiView';
8
- import { ICoreTerminal } from '../Types';
8
+ import { ICoreTerminal } from '../CoreTerminal';
9
9
  import { Disposable } from '../Lifecycle';
10
10
  import { Emitter } from '../Event';
11
11
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { IParams } from '../parser/Types';
7
7
  import { IDisposable, IFunctionIdentifier, IParser } from '@xterm/xterm';
8
- import { ICoreTerminal } from '../Types';
8
+ import { ICoreTerminal } from '../CoreTerminal';
9
9
 
10
10
  export class ParserApi implements IParser {
11
11
  constructor(private _core: ICoreTerminal) { }
@@ -3,7 +3,7 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { ICoreTerminal } from '../Types';
6
+ import { ICoreTerminal } from '../CoreTerminal';
7
7
  import { IUnicodeHandling, IUnicodeVersionProvider } from '@xterm/xterm';
8
8
 
9
9
  export class UnicodeApi implements IUnicodeHandling {
@@ -4,9 +4,8 @@
4
4
  */
5
5
 
6
6
  import { Disposable } from '../Lifecycle';
7
- import { IAttributeData, IBufferLine } from '../Types';
7
+ import { IAttributeData, IBuffer, IBufferLine, IBufferSet } from '../buffer/Types';
8
8
  import { BufferSet } from '../buffer/BufferSet';
9
- import { IBuffer, IBufferSet } from '../buffer/Types';
10
9
  import { IBufferService, ILogService, IOptionsService, type IBufferResizeEvent } from './Services';
11
10
  import { Emitter } from '../Event';
12
11
 
@@ -3,13 +3,13 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import type { IDeleteEvent, IInsertEvent } from '../CircularList';
6
+ import type { ICircularList, IDeleteEvent, IInsertEvent } from '../CircularList';
7
7
  import { MicrotaskTimer } from '../Async';
8
8
  import { css } from '../Color';
9
9
  import { Disposable, DisposableStore, MutableDisposable, toDisposable } from '../Lifecycle';
10
10
  import { IBufferService, IDecorationService, IInternalDecoration, ILogService } from './Services';
11
11
  import { SortedList } from '../SortedList';
12
- import { IColor, ICircularList } from '../Types';
12
+ import { IColor } from '../Types';
13
13
  import { IDecoration, IDecorationOptions, IMarker } from '@xterm/xterm';
14
14
  import { Emitter } from '../Event';
15
15
 
@@ -9,8 +9,8 @@
9
9
  * Licensed under the MIT License. See License.txt in the project root for license information.
10
10
  *--------------------------------------------------------------------------------------------*/
11
11
 
12
- import { IInstantiationService, IServiceIdentifier } from './Services';
13
- import { getServiceDependencies } from './ServiceRegistry';
12
+ import { IInstantiationService } from './Services';
13
+ import { IServiceIdentifier, getServiceDependencies } from './ServiceRegistry';
14
14
 
15
15
  export class ServiceCollection {
16
16
 
@@ -3,7 +3,8 @@
3
3
  * @license MIT
4
4
  */
5
5
  import { IBufferService, IOscLinkService } from './Services';
6
- import { IMarker, IOscLinkData } from '../Types';
6
+ import { IOscLinkData } from '../Types';
7
+ import { IMarker } from '../buffer/Types';
7
8
 
8
9
  export class OscLinkService implements IOscLinkService {
9
10
  public serviceBrand: any;
@@ -9,7 +9,11 @@
9
9
  * Licensed under the MIT License. See License.txt in the project root for license information.
10
10
  *--------------------------------------------------------------------------------------------*/
11
11
 
12
- import { IServiceIdentifier } from './Services';
12
+ export interface IServiceIdentifier<T> {
13
+ (...args: any[]): void;
14
+ type: T;
15
+ _id: string;
16
+ }
13
17
 
14
18
  const enum Constants {
15
19
  DI_TARGET = 'di$target',
@@ -4,9 +4,9 @@
4
4
  */
5
5
 
6
6
  import type { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty, IOverviewRulerOptions } from '@xterm/xterm';
7
- import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IKittyKeyboardState, IModes, IOscLinkData, IWindowOptions } from '../Types';
8
- import { IBuffer, IBufferSet } from '../buffer/Types';
9
- import { createDecorator } from './ServiceRegistry';
7
+ import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IKittyKeyboardState, IModes, IOscLinkData, IWindowOptions } from '../Types';
8
+ import { IAttributeData, IBuffer, IBufferSet } from '../buffer/Types';
9
+ import { createDecorator, IServiceIdentifier } from './ServiceRegistry';
10
10
  import type { Emitter, IEvent } from '../Event';
11
11
 
12
12
  export const IBufferService = createDecorator<IBufferService>('BufferService');
@@ -119,12 +119,6 @@ export interface ICharsetService {
119
119
  setgCharset(g: number, charset: ICharset | undefined): void;
120
120
  }
121
121
 
122
- export interface IServiceIdentifier<T> {
123
- (...args: any[]): void;
124
- type: T;
125
- _id: string;
126
- }
127
-
128
122
  export interface IBrandedService {
129
123
  serviceBrand: undefined;
130
124
  }
@@ -3,7 +3,6 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { UnicodeV6 } from '../input/UnicodeV6';
7
6
  import { IUnicodeService, IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from './Services';
8
7
  import { Emitter } from '../Event';
9
8
 
@@ -12,7 +11,7 @@ export class UnicodeService implements IUnicodeService {
12
11
 
13
12
  private _providers: {[key: string]: IUnicodeVersionProvider} = Object.create(null);
14
13
  private _active: string = '';
15
- private _activeProvider: IUnicodeVersionProvider;
14
+ private _activeProvider!: IUnicodeVersionProvider;
16
15
 
17
16
  private readonly _onChange = new Emitter<string>();
18
17
  public readonly onChange = this._onChange.event;
@@ -30,13 +29,6 @@ export class UnicodeService implements IUnicodeService {
30
29
  return ((state & 0xffffff) << 3) | ((width & 3) << 1) | (shouldJoin?1:0);
31
30
  }
32
31
 
33
- constructor() {
34
- const defaultProvider = new UnicodeV6();
35
- this.register(defaultProvider);
36
- this._active = defaultProvider.version;
37
- this._activeProvider = defaultProvider;
38
- }
39
-
40
32
  public dispose(): void {
41
33
  this._onChange.dispose();
42
34
  }
@@ -60,6 +52,9 @@ export class UnicodeService implements IUnicodeService {
60
52
 
61
53
  public register(provider: IUnicodeVersionProvider): void {
62
54
  this._providers[provider.version] = provider;
55
+ if (!this._active) {
56
+ this.activeVersion = provider.version;
57
+ }
63
58
  }
64
59
 
65
60
  /**