Skip to content

Commit b595c21

Browse files
committed
fix: correctly display symbols in Windows terminals that support Unicode
Nowadays more and more Windows terminals support Unicode. With this change we add support for this terminal and emulators as previously only `Hyper` was supported. We now added support for: - JetBrains terminal - VsCode terminal - Xterm - AlaCritty - Commander/ConEmu
1 parent 5d3bc73 commit b595c21

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

symbols.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
'use strict';
22

3-
const isHyper = typeof process !== 'undefined' && process.env.TERM_PROGRAM === 'Hyper';
4-
const isWindows = typeof process !== 'undefined' && process.platform === 'win32';
3+
const isWindows =
4+
typeof process !== 'undefined' && process.platform === 'win32';
55
const isLinux = typeof process !== 'undefined' && process.platform === 'linux';
6+
const windowsHasUnicodeSupport =
7+
process &&
8+
isWindows &&
9+
(process.env.TERM_PROGRAM === 'vscode' ||
10+
process.env.TERM_PROGRAM === 'Hyper' ||
11+
process.env.TERM === 'xterm-256color' ||
12+
process.env.TERM === 'alacritty' ||
13+
process.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm' ||
14+
process.env.ConEmuTask === '{cmd::Cmder}');
615

716
const common = {
817
ballotDisabled: '☒',
@@ -63,7 +72,7 @@ const other = Object.assign({}, common, {
6372
warning: '⚠'
6473
});
6574

66-
module.exports = (isWindows && !isHyper) ? windows : other;
75+
module.exports = (isWindows && !windowsHasUnicodeSupport) ? windows : other;
6776
Reflect.defineProperty(module.exports, 'common', { enumerable: false, value: common });
6877
Reflect.defineProperty(module.exports, 'windows', { enumerable: false, value: windows });
6978
Reflect.defineProperty(module.exports, 'other', { enumerable: false, value: other });

0 commit comments

Comments
 (0)