@xterm/xterm 5.5.0-beta.5 → 5.5.0-beta.6
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/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
|
*/
|