Skip to content

Commit 4fcce05

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 4fcce05

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

symbols.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
'use strict';
22

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

715
const common = {
816
ballotDisabled: '☒',
@@ -63,7 +71,7 @@ const other = Object.assign({}, common, {
6371
warning: '⚠'
6472
});
6573

66-
module.exports = (isWindows && !isHyper) ? windows : other;
74+
module.exports = (isWindows && !windowsHasUnicodeSupport) ? windows : other;
6775
Reflect.defineProperty(module.exports, 'common', { enumerable: false, value: common });
6876
Reflect.defineProperty(module.exports, 'windows', { enumerable: false, value: windows });
6977
Reflect.defineProperty(module.exports, 'other', { enumerable: false, value: other });

0 commit comments

Comments
 (0)