diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-12-07 19:14:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-07 19:14:56 +0800 |
commit | aba954b662cc1223d11ac3dc99323b9ebf687085 (patch) | |
tree | 708302f034e2f5907ada07a995b75d4f6f6a7086 /src/nvim/eval/funcs.c | |
parent | 94c2703a0390fc7908faf5dcde80615ddf5e616e (diff) | |
download | rneovim-aba954b662cc1223d11ac3dc99323b9ebf687085.tar.gz rneovim-aba954b662cc1223d11ac3dc99323b9ebf687085.tar.bz2 rneovim-aba954b662cc1223d11ac3dc99323b9ebf687085.zip |
fix(terminal): never propagate $COLORTERM from outer env (#26440)
If $COLORTERM is "truecolor" but the user sets 'notermguicolors',
propagating $COLORTERM to :terminal usually doesn't work well.
Diffstat (limited to 'src/nvim/eval/funcs.c')
-rw-r--r-- | src/nvim/eval/funcs.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 0054c47678..4029478072 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -3898,12 +3898,13 @@ static void f_jobresize(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) rettv->vval.v_number = 1; } -static const char *ignored_env_vars[] = { +static const char *pty_ignored_env_vars[] = { #ifndef MSWIN "COLUMNS", "LINES", "TERMCAP", "COLORFGBG", + "COLORTERM", #endif NULL }; @@ -3943,9 +3944,9 @@ static dict_T *create_environment(const dictitem_T *job_env, const bool clear_en // child process. We're removing them here so the user can still decide // they want to explicitly set them. for (size_t i = 0; - i < ARRAY_SIZE(ignored_env_vars) && ignored_env_vars[i]; + i < ARRAY_SIZE(pty_ignored_env_vars) && pty_ignored_env_vars[i]; i++) { - dictitem_T *dv = tv_dict_find(env, ignored_env_vars[i], -1); + dictitem_T *dv = tv_dict_find(env, pty_ignored_env_vars[i], -1); if (dv) { tv_dict_item_remove(env, dv); } @@ -3953,10 +3954,6 @@ static dict_T *create_environment(const dictitem_T *job_env, const bool clear_en #ifndef MSWIN // Set COLORTERM to "truecolor" if termguicolors is set if (p_tgc) { - dictitem_T *dv = tv_dict_find(env, S_LEN("COLORTERM")); - if (dv) { - tv_dict_item_remove(env, dv); - } tv_dict_add_str(env, S_LEN("COLORTERM"), "truecolor"); } #endif |