From 46cdf40b9b7a7f6093e6c9d90ffb45170e817cb3 Mon Sep 17 00:00:00 2001 From: Morten Enemark Lund Date: Mon, 7 Oct 2019 22:21:13 +0200 Subject: [PATCH] Remvoe win_unicode_console support The new Windows terminal solves the problem of unicode on windows much better --- setup.py | 1 - xonsh/environ.py | 8 -------- xonsh/main.py | 6 +----- xonsh/tools.py | 15 --------------- 4 files changed, 1 insertion(+), 29 deletions(-) diff --git a/setup.py b/setup.py index 2441d326d..f1fb40beb 100755 --- a/setup.py +++ b/setup.py @@ -398,7 +398,6 @@ def main(): skw["extras_require"] = { "ptk": ["prompt-toolkit"], "pygments": ["pygments>=2.2"], - "win": ["win_unicode_console"], "mac": ["gnureadline"], "linux": ["distro"], "proctitle": ["setproctitle"], diff --git a/xonsh/environ.py b/xonsh/environ.py index 500ce14ee..4eb16d294 100644 --- a/xonsh/environ.py +++ b/xonsh/environ.py @@ -59,7 +59,6 @@ from xonsh.tools import ( bool_seq_to_csv, DefaultNotGiven, print_exception, - setup_win_unicode_console, intensify_colors_on_win_setter, is_dynamic_cwd_width, to_dynamic_cwd_tuple, @@ -578,7 +577,6 @@ def DEFAULT_ENSURERS(): "VC_HG_SHOW_BRANCH": (is_bool, to_bool, bool_to_str), "VI_MODE": (is_bool, to_bool, bool_to_str), "VIRTUAL_ENV": (is_string, ensure_string, ensure_string), - "WIN_UNICODE_CONSOLE": (always_false, setup_win_unicode_console, bool_to_str), "XONSHRC": (is_env_path, str_to_env_path, env_path_to_str), "XONSH_APPEND_NEWLINE": (is_bool, to_bool, bool_to_str), "XONSH_AUTOPAIR": (is_bool, to_bool, bool_to_str), @@ -762,7 +760,6 @@ def DEFAULT_VALUES(): "VC_BRANCH_TIMEOUT": 0.2 if ON_WINDOWS else 0.1, "VC_HG_SHOW_BRANCH": True, "VI_MODE": False, - "WIN_UNICODE_CONSOLE": True, "XDG_CONFIG_HOME": os.path.expanduser(os.path.join("~", ".config")), "XDG_DATA_HOME": os.path.expanduser(os.path.join("~", ".local", "share")), "XONSHRC": default_xonshrc, @@ -1194,11 +1191,6 @@ def DEFAULT_DOCS(): "VIRTUAL_ENV": VarDocs( "Path to the currently active Python environment.", configurable=False ), - "WIN_UNICODE_CONSOLE": VarDocs( - "Enables unicode support in windows terminals. Requires the external " - "library ``win_unicode_console``.", - configurable=ON_WINDOWS, - ), "XDG_CONFIG_HOME": VarDocs( "Open desktop standard configuration home dir. This is the same " "default as used in the standard.", diff --git a/xonsh/main.py b/xonsh/main.py index 7f39c863e..45ab31a9c 100644 --- a/xonsh/main.py +++ b/xonsh/main.py @@ -17,7 +17,7 @@ from xonsh.pretty import pretty from xonsh.execer import Execer from xonsh.proc import HiddenCommandPipeline from xonsh.jobs import ignore_sigtstp -from xonsh.tools import setup_win_unicode_console, print_color, to_bool_or_int +from xonsh.tools import print_color, to_bool_or_int from xonsh.platform import HAS_PYGMENTS, ON_WINDOWS from xonsh.codecache import run_script_with_cache, run_code_with_cache from xonsh.xonfig import print_welcome_screen @@ -356,8 +356,6 @@ def premain(argv=None): env["XONSH_INTERACTIVE"] = args.force_interactive or ( args.mode == XonshMode.interactive ) - if ON_WINDOWS: - setup_win_unicode_console(env.get("WIN_UNICODE_CONSOLE", True)) return args @@ -462,8 +460,6 @@ def main_xonsh(args): def postmain(args=None): """Teardown for main xonsh entry point, accepts parsed arguments.""" - if ON_WINDOWS: - setup_win_unicode_console(enable=False) builtins.__xonsh__.shell = None diff --git a/xonsh/tools.py b/xonsh/tools.py index b239776c8..d6cb2fd6a 100644 --- a/xonsh/tools.py +++ b/xonsh/tools.py @@ -1556,21 +1556,6 @@ def dict_to_str(x): return str(x) -def setup_win_unicode_console(enable): - """"Enables or disables unicode display on windows.""" - try: - import win_unicode_console - except ImportError: - win_unicode_console = False - enable = to_bool(enable) - if ON_WINDOWS and win_unicode_console: - if enable: - win_unicode_console.enable() - else: - win_unicode_console.disable() - return enable - - # history validation _min_to_sec = lambda x: 60.0 * float(x)