diff options
author | LemonBoy <thatlemon@gmail.com> | 2022-04-15 20:50:46 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-04-15 20:50:46 +0100 |
commit | 7714231bb5b15f7c85453f3945c108478de1d08a (patch) | |
tree | 41748cd1bbbff5097437e576c617f19f11468dcf /src/misc1.c | |
parent | 31e5c60a682840959cae6273ccadd9aae48c928d (diff) | |
download | vim-git-7714231bb5b15f7c85453f3945c108478de1d08a.tar.gz |
patch 8.2.4754: using cached values after unsetting some environment variablesv8.2.4754
Problem: Still using cached values after unsetting some known environment
variables.
Solution: Take care of the side effects. (closes #10194)
Diffstat (limited to 'src/misc1.c')
-rw-r--r-- | src/misc1.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/misc1.c b/src/misc1.c index af83c108b..9aa8ecfba 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -1910,6 +1910,20 @@ vim_unsetenv(char_u *var) #endif } +/* + * Removes environment variable "name" and take care of side effects. + */ + void +vim_unsetenv_ext(char_u *var) +{ + vim_unsetenv(var); + + // "homedir" is not cleared, keep using the old value until $HOME is set. + if (STRICMP(var, "VIM") == 0) + didset_vim = FALSE; + else if (STRICMP(var, "VIMRUNTIME") == 0) + didset_vimruntime = FALSE; +} /* * Set environment variable "name" and take care of side effects. @@ -1922,8 +1936,7 @@ vim_setenv_ext(char_u *name, char_u *val) init_homedir(); else if (didset_vim && STRICMP(name, "VIM") == 0) didset_vim = FALSE; - else if (didset_vimruntime - && STRICMP(name, "VIMRUNTIME") == 0) + else if (didset_vimruntime && STRICMP(name, "VIMRUNTIME") == 0) didset_vimruntime = FALSE; } #endif |