No windows legacy terminal support when no ctypes

This commit is contained in:
Jeong, YunWon 2025-12-08 20:43:46 +09:00
parent f82a399d58
commit 6364fdfbca
3 changed files with 11 additions and 0 deletions

View file

@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### Changed
- Don't use windows legacy terminal support when ctypes is not available.
## [14.2.0] - 2025-10-09
### Changed

View file

@ -16,6 +16,7 @@ The following people have contributed to the development of Rich:
- [Ed Davis](https://github.com/davised)
- [Pete Davison](https://github.com/pd93)
- [James Estevez](https://github.com/jstvz)
- [Jeong, YunWon](https://github.com/youknowone)
- [Jonathan Eunice](https://github.com/jonathan-3play)
- [Aryaz Eghbali](https://github.com/AryazE)
- [Oleksis Fraga](https://github.com/oleksis)

View file

@ -581,6 +581,12 @@ def get_windows_console_features() -> "WindowsConsoleFeatures": # pragma: no co
def detect_legacy_windows() -> bool:
"""Detect legacy Windows."""
try:
import ctypes # noqa: F401
except ImportError:
# No ctypes doesn't mean no legacy windows,
# but legacy windows mode requires ctypes, so we force it off.
return False
return WINDOWS and not get_windows_console_features().vt