comparison src/filepath.c @ 19314:782f410c5df3 v8.2.0215

patch 8.2.0215: wrong file name shortening Commit: https://github.com/vim/vim/commit/a78e9c61a0ded9c5302bc77e889aa1b3d3467f61 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 5 21:14:00 2020 +0100 patch 8.2.0215: wrong file name shortening Problem: Wrong file name shortening. (Ingo Karkat) Solution: Better check for path separator. (Yasuhiro Matsumoto, closes #5583, closes #5584)
author Bram Moolenaar <Bram@vim.org>
date Wed, 05 Feb 2020 21:15:04 +0100
parents 80baa37506d0
children 1697a25328fd
comparison
equal deleted inserted replaced
19313:631cb8bf6027 19314:782f410c5df3
446 // Do not call shorten_fname() here since it removes the prefix 446 // Do not call shorten_fname() here since it removes the prefix
447 // even though the path does not have a prefix. 447 // even though the path does not have a prefix.
448 if (fnamencmp(p, dirname, namelen) == 0) 448 if (fnamencmp(p, dirname, namelen) == 0)
449 { 449 {
450 p += namelen; 450 p += namelen;
451 while (*p && vim_ispathsep(*p)) 451 if (vim_ispathsep(*p))
452 ++p;
453 *fnamep = p;
454 if (pbuf != NULL)
455 { 452 {
456 vim_free(*bufp); // free any allocated file name 453 while (*p && vim_ispathsep(*p))
457 *bufp = pbuf; 454 ++p;
458 pbuf = NULL; 455 *fnamep = p;
456 if (pbuf != NULL)
457 {
458 // free any allocated file name
459 vim_free(*bufp);
460 *bufp = pbuf;
461 pbuf = NULL;
462 }
459 } 463 }
460 } 464 }
461 } 465 }
462 else 466 else
463 { 467 {