@xterm/xterm 5.6.0-beta.82 → 5.6.0-beta.83
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/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.
|
|
4
|
+
"version": "5.6.0-beta.83",
|
|
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": "
|
|
110
|
+
"commit": "ffc61258f9042e464e9ebbe59eaea607d20edecc"
|
|
111
111
|
}
|
|
@@ -31,9 +31,10 @@ export function acquireTextureAtlas(
|
|
|
31
31
|
deviceCellHeight: number,
|
|
32
32
|
deviceCharWidth: number,
|
|
33
33
|
deviceCharHeight: number,
|
|
34
|
-
devicePixelRatio: number
|
|
34
|
+
devicePixelRatio: number,
|
|
35
|
+
deviceMaxTextureSize: number
|
|
35
36
|
): ITextureAtlas {
|
|
36
|
-
const newConfig = generateConfig(deviceCellWidth, deviceCellHeight, deviceCharWidth, deviceCharHeight, options, colors, devicePixelRatio);
|
|
37
|
+
const newConfig = generateConfig(deviceCellWidth, deviceCellHeight, deviceCharWidth, deviceCharHeight, options, colors, devicePixelRatio, deviceMaxTextureSize);
|
|
37
38
|
|
|
38
39
|
// Check to see if the terminal already owns this config
|
|
39
40
|
for (let i = 0; i < charAtlasCache.length; i++) {
|
|
@@ -9,7 +9,7 @@ import { ITerminalOptions } from '@xterm/xterm';
|
|
|
9
9
|
import { IColorSet, ReadonlyColorSet } from 'browser/Types';
|
|
10
10
|
import { NULL_COLOR } from 'common/Color';
|
|
11
11
|
|
|
12
|
-
export function generateConfig(deviceCellWidth: number, deviceCellHeight: number, deviceCharWidth: number, deviceCharHeight: number, options: Required<ITerminalOptions>, colors: ReadonlyColorSet, devicePixelRatio: number): ICharAtlasConfig {
|
|
12
|
+
export function generateConfig(deviceCellWidth: number, deviceCellHeight: number, deviceCharWidth: number, deviceCharHeight: number, options: Required<ITerminalOptions>, colors: ReadonlyColorSet, devicePixelRatio: number, deviceMaxTextureSize: number): ICharAtlasConfig {
|
|
13
13
|
// null out some fields that don't matter
|
|
14
14
|
const clonedColors: IColorSet = {
|
|
15
15
|
foreground: colors.foreground,
|
|
@@ -34,6 +34,7 @@ export function generateConfig(deviceCellWidth: number, deviceCellHeight: number
|
|
|
34
34
|
return {
|
|
35
35
|
customGlyphs: options.customGlyphs,
|
|
36
36
|
devicePixelRatio,
|
|
37
|
+
deviceMaxTextureSize,
|
|
37
38
|
letterSpacing: options.letterSpacing,
|
|
38
39
|
lineHeight: options.lineHeight,
|
|
39
40
|
deviceCellWidth: deviceCellWidth,
|
|
@@ -66,6 +66,7 @@ export class TextureAtlas implements ITextureAtlas {
|
|
|
66
66
|
|
|
67
67
|
// The set of atlas pages that can be written to
|
|
68
68
|
private _activePages: AtlasPage[] = [];
|
|
69
|
+
private _overflowSizePage: AtlasPage | undefined;
|
|
69
70
|
|
|
70
71
|
private _tmpCanvas: HTMLCanvasElement;
|
|
71
72
|
// A temporary context that glyphs are drawn to before being transfered to the atlas.
|
|
@@ -431,7 +432,7 @@ export class TextureAtlas implements ITextureAtlas {
|
|
|
431
432
|
// Allow 1 cell width per character, with a minimum of 2 (CJK), plus some padding. This is used
|
|
432
433
|
// to draw the glyph to the canvas as well as to restrict the bounding box search to ensure
|
|
433
434
|
// giant ligatures (eg. =====>) don't impact overall performance.
|
|
434
|
-
const allowedWidth = Math.min(this._config.deviceCellWidth * Math.max(chars.length, 2) + TMP_CANVAS_GLYPH_PADDING * 2, this.
|
|
435
|
+
const allowedWidth = Math.min(this._config.deviceCellWidth * Math.max(chars.length, 2) + TMP_CANVAS_GLYPH_PADDING * 2, this._config.deviceMaxTextureSize);
|
|
435
436
|
if (this._tmpCanvas.width < allowedWidth) {
|
|
436
437
|
this._tmpCanvas.width = allowedWidth;
|
|
437
438
|
}
|
|
@@ -772,6 +773,27 @@ export class TextureAtlas implements ITextureAtlas {
|
|
|
772
773
|
}
|
|
773
774
|
}
|
|
774
775
|
|
|
776
|
+
// Create a new page for oversized glyphs as they come up
|
|
777
|
+
if (rasterizedGlyph.size.x > this._textureSize) {
|
|
778
|
+
if (!this._overflowSizePage) {
|
|
779
|
+
this._overflowSizePage = new AtlasPage(this._document, this._config.deviceMaxTextureSize);
|
|
780
|
+
this.pages.push(this._overflowSizePage);
|
|
781
|
+
|
|
782
|
+
// Request the model to be cleared to refresh all texture pages.
|
|
783
|
+
this._requestClearModel = true;
|
|
784
|
+
this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas);
|
|
785
|
+
}
|
|
786
|
+
activePage = this._overflowSizePage;
|
|
787
|
+
activeRow = this._overflowSizePage.currentRow;
|
|
788
|
+
// Move to next row if necessary
|
|
789
|
+
if (activeRow.x + rasterizedGlyph.size.x >= activePage.canvas.width) {
|
|
790
|
+
activeRow.x = 0;
|
|
791
|
+
activeRow.y += activeRow.height;
|
|
792
|
+
activeRow.height = 0;
|
|
793
|
+
}
|
|
794
|
+
break;
|
|
795
|
+
}
|
|
796
|
+
|
|
775
797
|
// Create a new page if too much vertical space would be wasted or there is not enough room
|
|
776
798
|
// left in the page. The previous active row will become fixed in the process as it now has a
|
|
777
799
|
// fixed height
|
|
@@ -782,6 +804,7 @@ export class TextureAtlas implements ITextureAtlas {
|
|
|
782
804
|
if (activePage.currentRow.y + activePage.currentRow.height + rasterizedGlyph.size.y >= activePage.canvas.height) {
|
|
783
805
|
// Find the first page with room to create the new row on
|
|
784
806
|
let candidatePage: AtlasPage | undefined;
|
|
807
|
+
|
|
785
808
|
for (const p of this._activePages) {
|
|
786
809
|
if (p.currentRow.y + p.currentRow.height + rasterizedGlyph.size.y < p.canvas.height) {
|
|
787
810
|
candidatePage = p;
|