0
0
mirror of https://github.com/vim/vim.git synced 2025-09-30 04:44:14 -04:00

patch 8.2.3543: swapname has double slash when 'directory' ends in it

Problem:    Swapname has double slash when 'directory' ends in double slash.
            (Shane Smith)
Solution:   Remove the superfluous slash. (closes #8876)
This commit is contained in:
Bram Moolenaar
2021-10-19 22:12:25 +01:00
parent c5935a859e
commit 8b0e62c93b
3 changed files with 8 additions and 2 deletions

View File

@@ -2064,7 +2064,9 @@ recover_names(
/* /*
* Need _very_ long file names. * Need _very_ long file names.
* Append the full path to name with path separators made into percent * Append the full path to name with path separators made into percent
* signs, to dir. An unnamed buffer is handled as "" (<currentdir>/"") * signs, to "dir". An unnamed buffer is handled as "" (<currentdir>/"")
* The last character in "dir" must be an extra slash or backslash, it is
* removed.
*/ */
char_u * char_u *
make_percent_swname(char_u *dir, char_u *name) make_percent_swname(char_u *dir, char_u *name)
@@ -2081,6 +2083,8 @@ make_percent_swname(char_u *dir, char_u *name)
for (d = s; *d != NUL; MB_PTR_ADV(d)) for (d = s; *d != NUL; MB_PTR_ADV(d))
if (vim_ispathsep(*d)) if (vim_ispathsep(*d))
*d = '%'; *d = '%';
dir[STRLEN(dir) - 1] = NUL; // remove one trailing slash
d = concat_fnames(dir, s, TRUE); d = concat_fnames(dir, s, TRUE);
vim_free(s); vim_free(s);
} }

View File

@@ -410,7 +410,7 @@ func Test_swap_symlink()
" Check that this also works when 'directory' ends with '//' " Check that this also works when 'directory' ends with '//'
edit Xtestlink edit Xtestlink
call assert_match('Xtestfile\.swp$', s:swapname()) call assert_match('Xswapdir[/\\]%.*testdir%Xtestfile\.swp$', s:swapname())
bwipe! bwipe!
set dir& set dir&

View File

@@ -757,6 +757,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3543,
/**/ /**/
3542, 3542,
/**/ /**/