mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.0942: expanding to local dir after homedir keeps "~/"
Problem: Expanding to local dir after homedir keeps "~/".
Solution: Adjust modify_fname(). (Christian Brabandt, closes vim/vim#6205,
closes vim/vim#5979)
0e390f40e9
This commit is contained in:
parent
f47ba10636
commit
53e4434c72
@ -10700,7 +10700,7 @@ repeat:
|
|||||||
pbuf = NULL;
|
pbuf = NULL;
|
||||||
// Need full path first (use expand_env() to remove a "~/")
|
// Need full path first (use expand_env() to remove a "~/")
|
||||||
if (!has_fullname && !has_homerelative) {
|
if (!has_fullname && !has_homerelative) {
|
||||||
if (c == '.' && **fnamep == '~') {
|
if ((c == '.' || c == '~') && **fnamep == '~') {
|
||||||
p = pbuf = expand_env_save(*fnamep);
|
p = pbuf = expand_env_save(*fnamep);
|
||||||
} else {
|
} else {
|
||||||
p = pbuf = (char_u *)FullName_save((char *)*fnamep, FALSE);
|
p = pbuf = (char_u *)FullName_save((char *)*fnamep, FALSE);
|
||||||
|
@ -1111,10 +1111,9 @@ size_t home_replace(const buf_T *const buf, const char_u *src, char_u *const dst
|
|||||||
*dst_p++ = '~';
|
*dst_p++ = '~';
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it's just the home directory, add "/".
|
// Do not add directory separator into dst, because dst is
|
||||||
if (!vim_ispathsep(src[0]) && --dstlen > 0) {
|
// expected to just return the directory name without the
|
||||||
*dst_p++ = '/';
|
// directory separator '/'.
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (p == homedir_env_mod) {
|
if (p == homedir_env_mod) {
|
||||||
|
@ -31,6 +31,9 @@ func Test_fnamemodify()
|
|||||||
call assert_equal('tar', fnamemodify('abc.fb2.tar.gz', ':e:e:r'))
|
call assert_equal('tar', fnamemodify('abc.fb2.tar.gz', ':e:e:r'))
|
||||||
|
|
||||||
let cwd = getcwd()
|
let cwd = getcwd()
|
||||||
|
call chdir($HOME)
|
||||||
|
call assert_equal('foobar', fnamemodify('~/foobar', ':~:.'))
|
||||||
|
call chdir(cwd)
|
||||||
call mkdir($HOME . '/XXXXXXXX/a', 'p')
|
call mkdir($HOME . '/XXXXXXXX/a', 'p')
|
||||||
call mkdir($HOME . '/XXXXXXXX/b', 'p')
|
call mkdir($HOME . '/XXXXXXXX/b', 'p')
|
||||||
call chdir($HOME . '/XXXXXXXX/a/')
|
call chdir($HOME . '/XXXXXXXX/a/')
|
||||||
|
Loading…
Reference in New Issue
Block a user