@xterm/xterm 5.5.0-beta.4 → 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/lib/xterm.js +1 -1
- package/lib/xterm.js.map +1 -1
- package/package.json +1 -1
- package/src/browser/renderer/shared/RendererUtils.ts +30 -0
- package/src/browser/services/RenderService.ts +2 -1
- package/src/common/services/OptionsService.ts +1 -0
- package/src/common/services/Services.ts +1 -0
- package/typings/xterm.d.ts +17 -0
package/package.json
CHANGED
|
@@ -23,10 +23,40 @@ 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
|
}
|
|
29
33
|
|
|
34
|
+
export function isEmoji(codepoint: number): boolean {
|
|
35
|
+
return (
|
|
36
|
+
codepoint >= 0x1F600 && codepoint <= 0x1F64F || // Emoticons
|
|
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
|
|
43
|
+
codepoint >= 0x1F1E6 && codepoint <= 0x1F1FF
|
|
44
|
+
);
|
|
45
|
+
}
|
|
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
|
+
|
|
30
60
|
export function treatGlyphAsBackgroundColor(codepoint: number): boolean {
|
|
31
61
|
return isPowerlineGlyph(codepoint) || isBoxOrBlockGlyph(codepoint);
|
|
32
62
|
}
|
|
@@ -87,7 +87,8 @@ export class RenderService extends Disposable implements IRenderService {
|
|
|
87
87
|
'fontSize',
|
|
88
88
|
'fontWeight',
|
|
89
89
|
'fontWeightBold',
|
|
90
|
-
'minimumContrastRatio'
|
|
90
|
+
'minimumContrastRatio',
|
|
91
|
+
'rescaleOverlappingGlyphs'
|
|
91
92
|
], () => {
|
|
92
93
|
this.clear();
|
|
93
94
|
this.handleResize(bufferService.cols, bufferService.rows);
|
|
@@ -234,6 +234,7 @@ export interface ITerminalOptions {
|
|
|
234
234
|
macOptionIsMeta?: boolean;
|
|
235
235
|
macOptionClickForcesSelection?: boolean;
|
|
236
236
|
minimumContrastRatio?: number;
|
|
237
|
+
rescaleOverlappingGlyphs?: boolean;
|
|
237
238
|
rightClickSelectsWord?: boolean;
|
|
238
239
|
rows?: number;
|
|
239
240
|
screenReaderMode?: boolean;
|
package/typings/xterm.d.ts
CHANGED
|
@@ -209,6 +209,23 @@ declare module '@xterm/xterm' {
|
|
|
209
209
|
*/
|
|
210
210
|
minimumContrastRatio?: number;
|
|
211
211
|
|
|
212
|
+
/**
|
|
213
|
+
* Whether to rescale glyphs horizontally that are a single cell wide but
|
|
214
|
+
* have glyphs that would overlap following cell(s). This typically happens
|
|
215
|
+
* for ambiguous width characters (eg. the roman numeral characters U+2160+)
|
|
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
|
|
224
|
+
*
|
|
225
|
+
* Note that this doesn't work with the DOM renderer. The default is false.
|
|
226
|
+
*/
|
|
227
|
+
rescaleOverlappingGlyphs?: boolean;
|
|
228
|
+
|
|
212
229
|
/**
|
|
213
230
|
* Whether to select the word under the cursor on right click, this is
|
|
214
231
|
* standard behavior in a lot of macOS applications.
|