mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.0215: wrong file name shortening
Problem: Wrong file name shortening. (Ingo Karkat)
Solution: Better check for path separator. (Yasuhiro Matsumoto,
closes vim/vim#5583, closes vim/vim#5584)
a78e9c61a0
This commit is contained in:
parent
d457168e3b
commit
f47ba10636
@ -10725,14 +10725,17 @@ repeat:
|
|||||||
// even though the path does not have a prefix.
|
// even though the path does not have a prefix.
|
||||||
if (fnamencmp(p, dirname, namelen) == 0) {
|
if (fnamencmp(p, dirname, namelen) == 0) {
|
||||||
p += namelen;
|
p += namelen;
|
||||||
while (*p && vim_ispathsep(*p)) {
|
if (vim_ispathsep(*p)) {
|
||||||
++p;
|
while (*p && vim_ispathsep(*p)) {
|
||||||
}
|
p++;
|
||||||
*fnamep = p;
|
}
|
||||||
if (pbuf != NULL) {
|
*fnamep = p;
|
||||||
xfree(*bufp); // free any allocated file name
|
if (pbuf != NULL) {
|
||||||
*bufp = pbuf;
|
// free any allocated file name
|
||||||
pbuf = NULL;
|
xfree(*bufp);
|
||||||
|
*bufp = pbuf;
|
||||||
|
pbuf = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -36,6 +36,8 @@ func Test_fnamemodify()
|
|||||||
call chdir($HOME . '/XXXXXXXX/a/')
|
call chdir($HOME . '/XXXXXXXX/a/')
|
||||||
call assert_equal('foo', fnamemodify($HOME . '/XXXXXXXX/a/foo', ':p:~:.'))
|
call assert_equal('foo', fnamemodify($HOME . '/XXXXXXXX/a/foo', ':p:~:.'))
|
||||||
call assert_equal('~/XXXXXXXX/b/foo', fnamemodify($HOME . '/XXXXXXXX/b/foo', ':p:~:.'))
|
call assert_equal('~/XXXXXXXX/b/foo', fnamemodify($HOME . '/XXXXXXXX/b/foo', ':p:~:.'))
|
||||||
|
call mkdir($HOME . '/XXXXXXXX/a.ext', 'p')
|
||||||
|
call assert_equal('~/XXXXXXXX/a.ext/foo', fnamemodify($HOME . '/XXXXXXXX/a.ext/foo', ':p:~:.'))
|
||||||
call chdir(cwd)
|
call chdir(cwd)
|
||||||
call delete($HOME . '/XXXXXXXX', 'rf')
|
call delete($HOME . '/XXXXXXXX', 'rf')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user