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>
#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;
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
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 20,
/**/
19,
/**/