comparison src/filepath.c @ 20780:300fbeef8c82 v8.2.0942

patch 8.2.0942: expanding to local dir after homedir keeps "~/" Commit: https://github.com/vim/vim/commit/0e390f40e944036fb558a63b91238cfda128d95f Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jun 10 13:12:28 2020 +0200 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 https://github.com/vim/vim/issues/6205, closes #5979)
author Bram Moolenaar <Bram@vim.org>
date Wed, 10 Jun 2020 13:15:03 +0200
parents d91b8d1e5198
children 9064044fd4f6
comparison
equal deleted inserted replaced
20779:0eb9578c85b1 20780:300fbeef8c82
414 } 414 }
415 pbuf = NULL; 415 pbuf = NULL;
416 // Need full path first (use expand_env() to remove a "~/") 416 // Need full path first (use expand_env() to remove a "~/")
417 if (!has_fullname && !has_homerelative) 417 if (!has_fullname && !has_homerelative)
418 { 418 {
419 if (c == '.' && **fnamep == '~') 419 if ((c == '.' || c == '~') && **fnamep == '~')
420 p = pbuf = expand_env_save(*fnamep); 420 p = pbuf = expand_env_save(*fnamep);
421 else 421 else
422 p = pbuf = FullName_save(*fnamep, FALSE); 422 p = pbuf = FullName_save(*fnamep, FALSE);
423 } 423 }
424 else 424 else
2395 { 2395 {
2396 src += len; 2396 src += len;
2397 if (--dstlen > 0) 2397 if (--dstlen > 0)
2398 *dst++ = '~'; 2398 *dst++ = '~';
2399 2399
2400 /* 2400 // Do not add directory separator into dst, because dst is
2401 * If it's just the home directory, add "/". 2401 // expected to just return the directory name without the
2402 */ 2402 // directory separator '/'.
2403 if (!vim_ispathsep(src[0]) && --dstlen > 0)
2404 *dst++ = '/';
2405 break; 2403 break;
2406 } 2404 }
2407 if (p == homedir_env) 2405 if (p == homedir_env)
2408 break; 2406 break;
2409 p = homedir_env; 2407 p = homedir_env;