diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-21 11:37:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-21 11:37:13 +0800 |
commit | 6b9852cc4188d9ca7bce8e7592dcfca38539c743 (patch) | |
tree | 3e3dbcffc76ecac8ffa2862a1d307483c4091f0c /src/nvim/optionstr.c | |
parent | 506a3ec91359da077eee81c82d23c4805ad22f9a (diff) | |
download | rneovim-6b9852cc4188d9ca7bce8e7592dcfca38539c743.tar.gz rneovim-6b9852cc4188d9ca7bce8e7592dcfca38539c743.tar.bz2 rneovim-6b9852cc4188d9ca7bce8e7592dcfca38539c743.zip |
vim-patch:8.2.4754: using cached values after unsetting some environment variables (#19872)
Problem: Still using cached values after unsetting some known environment
variables.
Solution: Take care of the side effects. (closes vim/vim#10194)
https://github.com/vim/vim/commit/7714231bb5b15f7c85453f3945c108478de1d08a
Cherry-pick vim_setenv_ext() from patch 8.2.0200.
Diffstat (limited to 'src/nvim/optionstr.c')
-rw-r--r-- | src/nvim/optionstr.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c index 4ff14f0122..c50225dfdf 100644 --- a/src/nvim/optionstr.c +++ b/src/nvim/optionstr.c @@ -614,7 +614,6 @@ static int shada_idx = -1; /// Handle string options that need some action to perform when changed. /// The new value must be allocated. -/// Returns NULL for success, or an error message for an error. /// /// @param opt_idx index in options[] table /// @param varp pointer to the option variable @@ -623,6 +622,8 @@ static int shada_idx = -1; /// @param errbuflen length of errors buffer /// @param opt_flags OPT_LOCAL and/or OPT_GLOBAL /// @param value_checked value was checked to be safe, no need to set P_INSECURE +/// +/// @return NULL for success, or an untranslated error message for an error char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *errbuf, size_t errbuflen, int opt_flags, int *value_checked) { @@ -698,12 +699,10 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er } else if (varp == &p_hf) { // 'helpfile' // May compute new values for $VIM and $VIMRUNTIME if (didset_vim) { - os_setenv("VIM", "", 1); - didset_vim = false; + vim_unsetenv_ext("VIM"); } if (didset_vimruntime) { - os_setenv("VIMRUNTIME", "", 1); - didset_vimruntime = false; + vim_unsetenv_ext("VIMRUNTIME"); } } else if (varp == &p_rtp || varp == &p_pp) { // 'runtimepath' 'packpath' runtime_search_path_invalidate(); |