@xterm/xterm 5.6.0-beta.84 → 5.6.0-beta.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -226,6 +226,7 @@ Xterm.js is used in several world-class applications to provide great terminal e
226
226
  - [**OpenSFTP**](https://opensftp.com): Super beautiful SSH and SFTP integrated workspace client.
227
227
  - [**balena**](https://www.balena.io/): Balena is a full-stack solution for developing, deploying, updating, and troubleshooting IoT Edge devices. We use xterm.js to manage & debug devices on [balenaCloud](https://www.balena.io/cloud).
228
228
  - [**Filet Cloud**](https://github.com/fuglaro/filet-cloud): The lean and powerful personal cloud ⛅.
229
+ - [**ecmaOS**](https://ecmaos.sh): A kernel and suite of applications tying modern web technologies into a browser-based operating system.
229
230
  - [And much more...](https://github.com/xtermjs/xterm.js/network/dependents?package_id=UGFja2FnZS0xNjYzMjc4OQ%3D%3D)
230
231
 
231
232
  Do you use xterm.js in your application as well? Please [open a Pull Request](https://github.com/sourcelair/xterm.js/pulls) to include it here. We would love to have it on our list. Note: Please add any new contributions to the end of the list only.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xterm/xterm",
3
3
  "description": "Full xterm terminal, in your browser",
4
- "version": "5.6.0-beta.84",
4
+ "version": "5.6.0-beta.86",
5
5
  "main": "lib/xterm.js",
6
6
  "module": "lib/xterm.mjs",
7
7
  "style": "css/xterm.css",
@@ -107,5 +107,5 @@
107
107
  "ws": "^8.2.3",
108
108
  "xterm-benchmark": "^0.3.1"
109
109
  },
110
- "commit": "9e206415b891058a3db772fd070ea299325dc647"
110
+ "commit": "85992928a7458eeff55946d7deadc1265004baea"
111
111
  }
@@ -103,6 +103,7 @@ export class TextureAtlas implements ITextureAtlas {
103
103
  }
104
104
 
105
105
  public dispose(): void {
106
+ this._tmpCanvas.remove();
106
107
  for (const page of this.pages) {
107
108
  page.canvas.remove();
108
109
  }
@@ -122,7 +123,7 @@ export class TextureAtlas implements ITextureAtlas {
122
123
  for (let i = 33; i < 126; i++) {
123
124
  queue.enqueue(() => {
124
125
  if (!this._cacheMap.get(i, DEFAULT_COLOR, DEFAULT_COLOR, DEFAULT_EXT)) {
125
- const rasterizedGlyph = this._drawToCache(i, DEFAULT_COLOR, DEFAULT_COLOR, DEFAULT_EXT);
126
+ const rasterizedGlyph = this._drawToCache(i, DEFAULT_COLOR, DEFAULT_COLOR, DEFAULT_EXT, false, undefined);
126
127
  this._cacheMap.set(i, DEFAULT_COLOR, DEFAULT_COLOR, DEFAULT_EXT, rasterizedGlyph);
127
128
  }
128
129
  });
@@ -242,12 +243,12 @@ export class TextureAtlas implements ITextureAtlas {
242
243
  }
243
244
  }
244
245
 
245
- public getRasterizedGlyphCombinedChar(chars: string, bg: number, fg: number, ext: number, restrictToCellHeight: boolean): IRasterizedGlyph {
246
- return this._getFromCacheMap(this._cacheMapCombined, chars, bg, fg, ext, restrictToCellHeight);
246
+ public getRasterizedGlyphCombinedChar(chars: string, bg: number, fg: number, ext: number, restrictToCellHeight: boolean, domContainer: HTMLElement | undefined): IRasterizedGlyph {
247
+ return this._getFromCacheMap(this._cacheMapCombined, chars, bg, fg, ext, restrictToCellHeight, domContainer);
247
248
  }
248
249
 
249
- public getRasterizedGlyph(code: number, bg: number, fg: number, ext: number, restrictToCellHeight: boolean): IRasterizedGlyph {
250
- return this._getFromCacheMap(this._cacheMap, code, bg, fg, ext, restrictToCellHeight);
250
+ public getRasterizedGlyph(code: number, bg: number, fg: number, ext: number, restrictToCellHeight: boolean, domContainer: HTMLElement | undefined): IRasterizedGlyph {
251
+ return this._getFromCacheMap(this._cacheMap, code, bg, fg, ext, restrictToCellHeight, domContainer);
251
252
  }
252
253
 
253
254
  /**
@@ -259,11 +260,12 @@ export class TextureAtlas implements ITextureAtlas {
259
260
  bg: number,
260
261
  fg: number,
261
262
  ext: number,
262
- restrictToCellHeight: boolean = false
263
+ restrictToCellHeight: boolean,
264
+ domContainer: HTMLElement | undefined
263
265
  ): IRasterizedGlyph {
264
266
  $glyph = cacheMap.get(key, bg, fg, ext);
265
267
  if (!$glyph) {
266
- $glyph = this._drawToCache(key, bg, fg, ext, restrictToCellHeight);
268
+ $glyph = this._drawToCache(key, bg, fg, ext, restrictToCellHeight, domContainer);
267
269
  cacheMap.set(key, bg, fg, ext, $glyph);
268
270
  }
269
271
  return $glyph;
@@ -423,12 +425,20 @@ export class TextureAtlas implements ITextureAtlas {
423
425
  return this._config.colors.contrastCache;
424
426
  }
425
427
 
426
- private _drawToCache(codeOrChars: number | string, bg: number, fg: number, ext: number, restrictToCellHeight: boolean = false): IRasterizedGlyph {
428
+ private _drawToCache(codeOrChars: number | string, bg: number, fg: number, ext: number, restrictToCellHeight: boolean, domContainer: HTMLElement | undefined): IRasterizedGlyph {
427
429
  const chars = typeof codeOrChars === 'number' ? String.fromCharCode(codeOrChars) : codeOrChars;
428
430
 
429
431
  // Uncomment for debugging
430
432
  // console.log(`draw to cache "${chars}"`, bg, fg, ext);
431
433
 
434
+ // Attach the canvas to the DOM in order to inherit font-feature-settings
435
+ // from the parent elements. This is necessary for ligatures and variants to
436
+ // work.
437
+ if (domContainer && this._tmpCanvas.parentElement !== domContainer) {
438
+ this._tmpCanvas.style.display = 'none';
439
+ domContainer.append(this._tmpCanvas);
440
+ }
441
+
432
442
  // Allow 1 cell width per character, with a minimum of 2 (CJK), plus some padding. This is used
433
443
  // to draw the glyph to the canvas as well as to restrict the bounding box search to ensure
434
444
  // giant ligatures (eg. =====>) don't impact overall performance.
@@ -108,8 +108,8 @@ export interface ITextureAtlas extends IDisposable {
108
108
  * Clear all glyphs from the texture atlas.
109
109
  */
110
110
  clearTexture(): void;
111
- getRasterizedGlyph(code: number, bg: number, fg: number, ext: number, restrictToCellHeight: boolean): IRasterizedGlyph;
112
- getRasterizedGlyphCombinedChar(chars: string, bg: number, fg: number, ext: number, restrictToCellHeight: boolean): IRasterizedGlyph;
111
+ getRasterizedGlyph(code: number, bg: number, fg: number, ext: number, restrictToCellHeight: boolean, domContainer: HTMLElement | undefined): IRasterizedGlyph;
112
+ getRasterizedGlyphCombinedChar(chars: string, bg: number, fg: number, ext: number, restrictToCellHeight: boolean, domContainer: HTMLElement | undefined): IRasterizedGlyph;
113
113
  }
114
114
 
115
115
  /**