diff --git a/src/nvim/path.c b/src/nvim/path.c index 4c16adde4c..80890acb7d 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -1538,6 +1538,13 @@ void simplify_filename(char *filename) } while (vim_ispathsep(*p)); } char *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 { // At this point "p" is pointing to the char following a single "/" diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index 143fdc8073..2bf2f78aa0 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -383,6 +383,10 @@ func Test_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', simplify('.///dir//file')) call assert_equal('./dir/file', simplify('./dir/./file')) @@ -2069,6 +2073,7 @@ endfunc " Test for the inputdialog() function func Test_inputdialog() + set timeout timeoutlen=10 if has('gui_running') call assert_fails('let v=inputdialog([], "xx")', 'E730:') call assert_fails('let v=inputdialog("Q", [])', 'E730:') @@ -2078,6 +2083,7 @@ func Test_inputdialog() call feedkeys(":let v=inputdialog('Q:', 'xx', 'yy')\\", 'xt') call assert_equal('yy', v) endif + set timeout& timeoutlen& endfunc " Test for inputlist()