Skip to content

Commit 71b0380

Browse files
committed
Used is-legacy-terminal to widen early return
1 parent be8198f commit 71b0380

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

is-unicode-supported/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ license-files = [
2020
dependencies = [
2121
"blessed~=1.33.0",
2222
"colorama~=0.4.6 ; platform_system == 'Windows'",
23+
"is-legacy-terminal~=1.0.0",
2324
"json5~=0.13.0",
2425
]
2526
requires-python = ">=3.8,<4"

is-unicode-supported/src/is_unicode_supported/api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import os, sys
1+
import sys
22

3-
import blessed
3+
import blessed, is_legacy_terminal
44

55
def is_unicode_supported() -> bool:
66
if hasattr(is_unicode_supported, '_cached'):
77
return is_unicode_supported._cached
88

9-
if sys.platform == 'win32' and not os.environ.get('WT_SESSION'):
9+
if not is_legacy_terminal(): # type: ignore
1010
is_unicode_supported._cached = False
11-
return False # legacy Win consoles don't suport wide chars
11+
return False # legacy terminals don't suport wide chars
1212

1313
# Measure rendered width of wide CJK char
1414
terminal = blessed.Terminal()

0 commit comments

Comments
 (0)