mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.0985: simplify() does not remove slashes from "///path"
Problem: Simplify() does not remove slashes from "///path". Solution: Reduce > 2 slashes to one. (closes #6263)
This commit is contained in:
parent
ab176ce982
commit
fdcbe3c3fe
@ -2641,6 +2641,14 @@ simplify_filename(char_u *filename)
|
|||||||
while (vim_ispathsep(*p));
|
while (vim_ispathsep(*p));
|
||||||
}
|
}
|
||||||
start = p; // remember start after "c:/" or "/" or "///"
|
start = p; // remember start after "c:/" or "/" or "///"
|
||||||
|
#ifdef UNIX
|
||||||
|
// Posix says that "//path" is unchanged but "///path" is "/path".
|
||||||
|
if (start > filename + 2)
|
||||||
|
{
|
||||||
|
STRMOVE(filename + 1, p);
|
||||||
|
start = p = filename + 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -463,6 +463,10 @@ func Test_simplify()
|
|||||||
call assert_equal('/', simplify('/.'))
|
call assert_equal('/', simplify('/.'))
|
||||||
call assert_equal('/', simplify('/..'))
|
call assert_equal('/', simplify('/..'))
|
||||||
call assert_equal('/...', simplify('/...'))
|
call assert_equal('/...', simplify('/...'))
|
||||||
|
call assert_equal('//path', simplify('//path'))
|
||||||
|
call assert_equal('/path', simplify('///path'))
|
||||||
|
call assert_equal('/path', simplify('////path'))
|
||||||
|
|
||||||
call assert_equal('./dir/file', './dir/file'->simplify())
|
call assert_equal('./dir/file', './dir/file'->simplify())
|
||||||
call assert_equal('./dir/file', simplify('.///dir//file'))
|
call assert_equal('./dir/file', simplify('.///dir//file'))
|
||||||
call assert_equal('./dir/file', simplify('./dir/./file'))
|
call assert_equal('./dir/file', simplify('./dir/./file'))
|
||||||
@ -1355,6 +1359,7 @@ endfunc
|
|||||||
|
|
||||||
" Test for the inputdialog() function
|
" Test for the inputdialog() function
|
||||||
func Test_inputdialog()
|
func Test_inputdialog()
|
||||||
|
set timeout timeoutlen=10
|
||||||
if has('gui_running')
|
if has('gui_running')
|
||||||
call assert_fails('let v=inputdialog([], "xx")', 'E730:')
|
call assert_fails('let v=inputdialog([], "xx")', 'E730:')
|
||||||
call assert_fails('let v=inputdialog("Q", [])', 'E730:')
|
call assert_fails('let v=inputdialog("Q", [])', 'E730:')
|
||||||
@ -1364,6 +1369,7 @@ func Test_inputdialog()
|
|||||||
call feedkeys(":let v=inputdialog('Q:', 'xx', 'yy')\<CR>\<Esc>", 'xt')
|
call feedkeys(":let v=inputdialog('Q:', 'xx', 'yy')\<CR>\<Esc>", 'xt')
|
||||||
call assert_equal('yy', v)
|
call assert_equal('yy', v)
|
||||||
endif
|
endif
|
||||||
|
set timeout& timeoutlen&
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test for inputlist()
|
" Test for inputlist()
|
||||||
@ -1916,7 +1922,7 @@ func Test_readdirex()
|
|||||||
\ ->map({-> v:val.name})
|
\ ->map({-> v:val.name})
|
||||||
call sort(files)->assert_equal(['bar.txt', 'dir', 'foo.txt'])
|
call sort(files)->assert_equal(['bar.txt', 'dir', 'foo.txt'])
|
||||||
|
|
||||||
" report brocken link correctly
|
" report broken link correctly
|
||||||
if has("unix")
|
if has("unix")
|
||||||
call writefile([], 'Xdir/abc.txt')
|
call writefile([], 'Xdir/abc.txt')
|
||||||
call system("ln -s Xdir/abc.txt Xdir/link")
|
call system("ln -s Xdir/abc.txt Xdir/link")
|
||||||
|
@ -754,6 +754,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 */
|
||||||
|
/**/
|
||||||
|
985,
|
||||||
/**/
|
/**/
|
||||||
984,
|
984,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user