Mercurial > vim
diff src/eval.c @ 14393:c62601adad69 v8.1.0211
patch 8.1.0211: expanding a file name "~" results in $HOME
commit https://github.com/vim/vim/commit/00136dc321586800986e8f743c2f108f5eecbf92
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jul 25 21:19:13 2018 +0200
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 https://github.com/vim/vim/issues/3072)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 25 Jul 2018 21:30:06 +0200 |
parents | 46f14852a919 |
children | e4c553e9132b |
line wrap: on
line diff
--- a/src/eval.c +++ b/src/eval.c @@ -9690,11 +9690,12 @@ shortpath_for_partial( */ int modify_fname( - char_u *src, /* string with modifiers */ - int *usedlen, /* characters after src that are used */ - char_u **fnamep, /* file name so far */ - char_u **bufp, /* buffer for allocated file name or NULL */ - int *fnamelen) /* length of fnamep */ + char_u *src, // string with modifiers + int tilde_file, // "~" is a file name, not $HOME + int *usedlen, // characters after src that are used + char_u **fnamep, // file name so far + char_u **bufp, // buffer for allocated file name or NULL + int *fnamelen) // length of fnamep { int valid = 0; char_u *tail; @@ -9724,8 +9725,8 @@ repeat: || (*fnamep)[1] == '\\' # endif || (*fnamep)[1] == NUL) - #endif + && !(tilde_file && (*fnamep)[1] == NUL) ) { *fnamep = expand_env_save(*fnamep);