[+] termenv: Detect system when detecting ansi mode

This commit is contained in:
Azalea (on HyDEV-Daisy) 2022-10-23 01:36:09 -04:00
parent cd4849f0b8
commit 75ed187e72
No known key found for this signature in database
GPG key ID: E289FAC0DA92DD2B

View file

@ -80,6 +80,15 @@ def windows_detect_ansi_mode() -> AnsiMode | None:
return 'rgb'
def detect_ansi_mode() -> AnsiMode | None:
system = platform.system().lower()
if system.startswith("linux") or system.startswith("darwin"):
return unix_detect_ansi_mode()
if system.startswith("windows"):
return windows_detect_ansi_mode()
return None
def unix_read_osc(seq: int) -> str:
# screen/tmux can't support OSC, because they can be connected to multiple
# terminals concurrently.