diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-05-25 17:22:19 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-05-25 20:36:01 -0400 |
commit | 08aa9b00237ab45dadeffdf381e0e3c228337e53 (patch) | |
tree | 957ca9030f1b97b48e8befb38e1bbe185b0251ad /src/nvim/eval.c | |
parent | 55419a6904306c21e6537a3b891df761ac352540 (diff) | |
download | rneovim-08aa9b00237ab45dadeffdf381e0e3c228337e53.tar.gz rneovim-08aa9b00237ab45dadeffdf381e0e3c228337e53.tar.bz2 rneovim-08aa9b00237ab45dadeffdf381e0e3c228337e53.zip |
vim-patch:8.1.0211: expanding a file name "~" results in $HOME
Problem: Expanding a file name "~" results in $HOME. (Aidan Shafran)
Solution: Change "~" to "./~" before expanding. (closes vim/vim#3072)
https://github.com/vim/vim/commit/00136dc321586800986e8f743c2f108f5eecbf92
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 12e309bfdc..78a6092fa1 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -8868,8 +8868,8 @@ static void f_fnamemodify(typval_T *argvars, typval_T *rettv, FunPtr fptr) } else { len = strlen(fname); size_t usedlen = 0; - (void)modify_fname((char_u *)mods, &usedlen, (char_u **)&fname, &fbuf, - &len); + (void)modify_fname((char_u *)mods, false, &usedlen, + (char_u **)&fname, &fbuf, &len); } rettv->v_type = VAR_STRING; @@ -22623,6 +22623,7 @@ void reset_v_option_vars(void) int modify_fname( char_u *src, // string with modifiers + bool tilde_file, // "~" is a file name, not $HOME size_t *usedlen, // characters after src that are used char_u **fnamep, // file name so far char_u **bufp, // buffer for allocated file name or NULL @@ -22652,8 +22653,8 @@ repeat: || (*fnamep)[1] == '\\' # endif || (*fnamep)[1] == NUL) - #endif + && !(tilde_file && (*fnamep)[1] == NUL) ) { *fnamep = expand_env_save(*fnamep); xfree(*bufp); /* free any allocated file name */ |