@xterm/xterm 5.5.0-beta.5 → 5.5.0-beta.7
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
|
@@ -23,6 +23,10 @@ export function isRestrictedPowerlineGlyph(codepoint: number): boolean {
|
|
|
23
23
|
return 0xE0B0 <= codepoint && codepoint <= 0xE0B7;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
function isNerdFontGlyph(codepoint: number): boolean {
|
|
27
|
+
return 0xE000 <= codepoint && codepoint <= 0xF8FF;
|
|
28
|
+
}
|
|
29
|
+
|
|
26
30
|
function isBoxOrBlockGlyph(codepoint: number): boolean {
|
|
27
31
|
return 0x2500 <= codepoint && codepoint <= 0x259F;
|
|
28
32
|
}
|
|
@@ -30,16 +34,29 @@ function isBoxOrBlockGlyph(codepoint: number): boolean {
|
|
|
30
34
|
export function isEmoji(codepoint: number): boolean {
|
|
31
35
|
return (
|
|
32
36
|
codepoint >= 0x1F600 && codepoint <= 0x1F64F || // Emoticons
|
|
33
|
-
codepoint >= 0x1F300 && codepoint <= 0x1F5FF ||
|
|
34
|
-
codepoint >= 0x1F680 && codepoint <= 0x1F6FF ||
|
|
35
|
-
codepoint >= 0x2600
|
|
36
|
-
codepoint >= 0x2700
|
|
37
|
-
codepoint >= 0xFE00
|
|
38
|
-
codepoint >= 0x1F900 && codepoint <= 0x1F9FF ||
|
|
37
|
+
codepoint >= 0x1F300 && codepoint <= 0x1F5FF || // Misc Symbols and Pictographs
|
|
38
|
+
codepoint >= 0x1F680 && codepoint <= 0x1F6FF || // Transport and Map
|
|
39
|
+
codepoint >= 0x2600 && codepoint <= 0x26FF || // Misc symbols
|
|
40
|
+
codepoint >= 0x2700 && codepoint <= 0x27BF || // Dingbats
|
|
41
|
+
codepoint >= 0xFE00 && codepoint <= 0xFE0F || // Variation Selectors
|
|
42
|
+
codepoint >= 0x1F900 && codepoint <= 0x1F9FF || // Supplemental Symbols and Pictographs
|
|
39
43
|
codepoint >= 0x1F1E6 && codepoint <= 0x1F1FF
|
|
40
44
|
);
|
|
41
45
|
}
|
|
42
46
|
|
|
47
|
+
export function allowRescaling(codepoint: number | undefined, width: number, glyphSizeX: number, deviceCellWidth: number): boolean {
|
|
48
|
+
return (
|
|
49
|
+
// Is single cell width
|
|
50
|
+
width === 1 &&
|
|
51
|
+
// Glyph exceeds cell bounds, + 1 to avoid hurting readability
|
|
52
|
+
glyphSizeX > deviceCellWidth + 1 &&
|
|
53
|
+
// Never rescale emoji
|
|
54
|
+
codepoint !== undefined && !isEmoji(codepoint) &&
|
|
55
|
+
// Never rescale powerline or nerd fonts
|
|
56
|
+
!isPowerlineGlyph(codepoint) && !isNerdFontGlyph(codepoint)
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
43
60
|
export function treatGlyphAsBackgroundColor(codepoint: number): boolean {
|
|
44
61
|
return isPowerlineGlyph(codepoint) || isBoxOrBlockGlyph(codepoint);
|
|
45
62
|
}
|
package/src/common/Color.ts
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { isNode } from 'common/Platform';
|
|
7
6
|
import { IColor, IColorRGB } from 'common/Types';
|
|
8
7
|
|
|
9
8
|
let $r = 0;
|
|
@@ -117,9 +116,10 @@ export namespace color {
|
|
|
117
116
|
* '#rrggbbaa').
|
|
118
117
|
*/
|
|
119
118
|
export namespace css {
|
|
119
|
+
// Attempt to set get the shared canvas context
|
|
120
120
|
let $ctx: CanvasRenderingContext2D | undefined;
|
|
121
121
|
let $litmusColor: CanvasGradient | undefined;
|
|
122
|
-
|
|
122
|
+
try {
|
|
123
123
|
// This is guaranteed to run in the first window, so document should be correct
|
|
124
124
|
const canvas = document.createElement('canvas');
|
|
125
125
|
canvas.width = 1;
|
|
@@ -133,6 +133,9 @@ export namespace css {
|
|
|
133
133
|
$litmusColor = $ctx.createLinearGradient(0, 0, 1, 1);
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
+
catch {
|
|
137
|
+
// noop
|
|
138
|
+
}
|
|
136
139
|
|
|
137
140
|
/**
|
|
138
141
|
* Converts a css string to an IColor, this should handle all valid CSS color strings and will
|
package/src/common/Platform.ts
CHANGED
|
@@ -14,7 +14,7 @@ interface INavigator {
|
|
|
14
14
|
declare const navigator: INavigator;
|
|
15
15
|
declare const process: unknown;
|
|
16
16
|
|
|
17
|
-
export const isNode = (typeof process !== 'undefined') ? true : false;
|
|
17
|
+
export const isNode = (typeof process !== 'undefined' && 'title' in (process as any)) ? true : false;
|
|
18
18
|
const userAgent = (isNode) ? 'node' : navigator.userAgent;
|
|
19
19
|
const platform = (isNode) ? 'node' : navigator.platform;
|
|
20
20
|
|
package/typings/xterm.d.ts
CHANGED
|
@@ -213,8 +213,14 @@ declare module '@xterm/xterm' {
|
|
|
213
213
|
* Whether to rescale glyphs horizontally that are a single cell wide but
|
|
214
214
|
* have glyphs that would overlap following cell(s). This typically happens
|
|
215
215
|
* for ambiguous width characters (eg. the roman numeral characters U+2160+)
|
|
216
|
-
* which aren't featured in monospace fonts.
|
|
217
|
-
*
|
|
216
|
+
* which aren't featured in monospace fonts. This is an important feature
|
|
217
|
+
* for achieving GB18030 compliance.
|
|
218
|
+
*
|
|
219
|
+
* The following glyphs will never be rescaled:
|
|
220
|
+
*
|
|
221
|
+
* - Emoji glyphs
|
|
222
|
+
* - Powerline glyphs
|
|
223
|
+
* - Nerd font glyphs
|
|
218
224
|
*
|
|
219
225
|
* Note that this doesn't work with the DOM renderer. The default is false.
|
|
220
226
|
*/
|