patch 9.2.0020: Wrong shortened buffer after :cd with duplicate slashes

Problem:  Wrong shortened buffer name after :cd with duplicate slashes.
Solution: Skip over multiple consecutive path separators (zeertzjq).

related: neovim/neovim#37080
closes:  #19444

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2026-02-18 21:27:50 +00:00
committed by Christian Brabandt
parent 06a604dc8e
commit f245e17ac7
3 changed files with 16 additions and 1 deletions
+3 -1
View File
@@ -3457,7 +3457,9 @@ shorten_fname(char_u *full_path, char_u *dir_name)
#endif
{
if (vim_ispathsep(*p))
++p;
do
++p;
while (vim_ispathsep_nocolon(*p));
#ifndef VMS // the path separator is always part of the path
else
p = NULL;
+11
View File
@@ -409,4 +409,15 @@ func Test_cd_symlinks()
call chdir(savedir)
endfunc
func Test_cd_shorten_bufname_with_duplicate_slashes()
let savedir = getcwd()
call mkdir('Xexistingdir', 'R')
new Xexistingdir//foo/bar
cd Xexistingdir
call assert_equal('foo/bar', bufname('%'))
call chdir(savedir)
bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+2
View File
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
20,
/**/
19,
/**/