Fix env LC_CTYPE=UTF-8 not working on macOS
This commit is contained in:
parent
2dbeb151f3
commit
4c4f6983d1
@ -156,9 +156,12 @@ def default_env() -> Dict[str, str]:
|
||||
|
||||
def set_default_env(val: Optional[Dict[str, str]] = None) -> None:
|
||||
env = process_env().copy()
|
||||
has_lctype = False
|
||||
if val:
|
||||
has_lctype = 'LC_CTYPE' in val
|
||||
env.update(val)
|
||||
setattr(default_env, 'env', env)
|
||||
setattr(default_env, 'lc_ctype_set_by_user', has_lctype)
|
||||
|
||||
|
||||
def openpty() -> Tuple[int, int]:
|
||||
@ -210,7 +213,8 @@ class Child:
|
||||
env: Optional[Dict[str, str]] = getattr(self, '_final_env', None)
|
||||
if env is None:
|
||||
env = self._final_env = default_env().copy()
|
||||
if is_macos and env.get('LC_CTYPE') == 'UTF-8' and not sys._xoptions.get('lc_ctype_before_python'):
|
||||
if is_macos and env.get('LC_CTYPE') == 'UTF-8' and not sys._xoptions.get(
|
||||
'lc_ctype_before_python') and not getattr(default_env, 'lc_ctype_set_by_user', False):
|
||||
del env['LC_CTYPE']
|
||||
env.update(self.env)
|
||||
env['TERM'] = self.opts.term
|
||||
|
||||
@ -249,7 +249,6 @@ def expand_listen_on(listen_on: str, from_config_file: bool) -> str:
|
||||
|
||||
|
||||
def setup_environment(opts: OptionsStub, cli_opts: CLIOptions) -> None:
|
||||
extra_env = opts.env.copy()
|
||||
if opts.editor == '.':
|
||||
editor = get_editor_from_env(os.environ)
|
||||
if not editor:
|
||||
@ -266,7 +265,7 @@ def setup_environment(opts: OptionsStub, cli_opts: CLIOptions) -> None:
|
||||
if cli_opts.listen_on and opts.allow_remote_control != 'n':
|
||||
cli_opts.listen_on = expand_listen_on(cli_opts.listen_on, from_config_file)
|
||||
os.environ['KITTY_LISTEN_ON'] = cli_opts.listen_on
|
||||
set_default_env(extra_env)
|
||||
set_default_env(opts.env.copy())
|
||||
|
||||
|
||||
def set_locale() -> None:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user