diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-02-07 06:48:10 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-02-07 06:48:10 +0800 |
commit | f47ba10636b498430fc8d2d490e5bdf6b4e01033 (patch) | |
tree | d737dadbc896ffff37d37a420c794fac55c5409f /src/nvim/eval.c | |
parent | d457168e3b6078ae018a2b1fe59ff54f82d3ba14 (diff) | |
download | rneovim-f47ba10636b498430fc8d2d490e5bdf6b4e01033.tar.gz rneovim-f47ba10636b498430fc8d2d490e5bdf6b4e01033.tar.bz2 rneovim-f47ba10636b498430fc8d2d490e5bdf6b4e01033.zip |
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)
https://github.com/vim/vim/commit/a78e9c61a0ded9c5302bc77e889aa1b3d3467f61
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 70909b46cb..0fe928beb7 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -10725,14 +10725,17 @@ repeat: // even though the path does not have a prefix. if (fnamencmp(p, dirname, namelen) == 0) { p += namelen; - while (*p && vim_ispathsep(*p)) { - ++p; - } - *fnamep = p; - if (pbuf != NULL) { - xfree(*bufp); // free any allocated file name - *bufp = pbuf; - pbuf = NULL; + if (vim_ispathsep(*p)) { + while (*p && vim_ispathsep(*p)) { + p++; + } + *fnamep = p; + if (pbuf != NULL) { + // free any allocated file name + xfree(*bufp); + *bufp = pbuf; + pbuf = NULL; + } } } } else { |