diff --git a/CHANGELOG.md b/CHANGELOG.md index c64b20a4..f0e1dcea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.0.1] - 2020-05-08 +### Fixed + +- Issue with Windows legacy support https://github.com/willmcgugan/rich/issues/59 + +## [1.0.1] - 2020-05-08 + ### Changed - Applied console markup after highlighting diff --git a/pyproject.toml b/pyproject.toml index a74bc9cd..3099f743 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "rich" homepage = "https://github.com/willmcgugan/rich" documentation = "https://rich.readthedocs.io/en/latest/" -version = "1.0.1" +version = "1.0.2" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" authors = ["Will McGugan "] license = "MIT" diff --git a/rich/console.py b/rich/console.py index ff9ee66c..d3e1b548 100644 --- a/rich/console.py +++ b/rich/console.py @@ -210,8 +210,12 @@ class ConsoleThreadLocals(threading.local): control: List[str] = field(default_factory=list) -def _enable_legacy_windows_support() -> None: - """Initialize Windows legacy support.""" +def detect_legacy_windows() -> bool: + """Detect legacy Windows.""" + return "WINDIR" in os.environ and "WT_SESSION" not in os.environ + + +if detect_legacy_windows(): from colorama import init init() @@ -266,12 +270,11 @@ class Console: self._markup = markup self._emoji = emoji self._highlight = highlight - self.legacy_windows: bool = "WINDIR" in os.environ and not "WT_SESSION" in os.environ + self.legacy_windows: bool = detect_legacy_windows() self._color_system: Optional[ColorSystem] self._force_terminal = force_terminal if self.legacy_windows: - _enable_legacy_windows_support() self.file = file or sys.stdout self._color_system = COLOR_SYSTEMS["windows"] else: