From: zeertzjq Date: Wed, 18 Feb 2026 21:27:50 +0000 (+0000) Subject: patch 9.2.0020: Wrong shortened buffer after :cd with duplicate slashes X-Git-Tag: v9.2.0020^0 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f245e17ac70df43fd7fe650c7227bb16a4615283;p=thirdparty%2Fvim.git 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 Signed-off-by: Christian Brabandt --- diff --git a/src/fileio.c b/src/fileio.c index 0a4ca648d8..9aceaf8876 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -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; diff --git a/src/testdir/test_cd.vim b/src/testdir/test_cd.vim index 9b74d8fdca..e95c7c2e0e 100644 --- a/src/testdir/test_cd.vim +++ b/src/testdir/test_cd.vim @@ -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 diff --git a/src/version.c b/src/version.c index 8fabd64ed3..394a536da0 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 20, /**/ 19, /**/