mirror of
https://github.com/vim/vim.git
synced 2025-10-26 09:14:23 -04:00
patch 9.1.1646: MS-Windows: completion cannot handle implicit drive letters
Problem: MS-Windows: completion cannot handle implicit drive letters
Solution: Consider paths like \folder and /folder as absolute
(Miguel Barro).
closes: #17829
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Miguel Barro <miguel.barro@live.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
59799f3afa
commit
a2f13bf782
@@ -221,6 +221,39 @@ func Test_cd_completion()
|
||||
call assert_equal('"' .. cmd .. ' XComplDir1/ XComplDir2/ XComplDir3/', @:)
|
||||
endfor
|
||||
set cdpath&
|
||||
|
||||
if has('win32')
|
||||
" Test windows absolute path completion
|
||||
" Retrieve a suitable dir in the current drive
|
||||
let dir = readdir('/', 'isdirectory("/" .. v:val) && len(v:val) > 2')[-1]
|
||||
" Get partial path
|
||||
let partial = dir[0:-2]
|
||||
" Get the current drive letter
|
||||
let old = chdir('/' . dir)
|
||||
let full = getcwd()
|
||||
let drive = full[0]
|
||||
call chdir(old)
|
||||
|
||||
for cmd in ['cd', 'chdir', 'lcd', 'lchdir', 'tcd', 'tchdir']
|
||||
for sep in [ '/', '\']
|
||||
|
||||
" Explicit drive letter
|
||||
call feedkeys(':' .. cmd .. ' ' .. drive .. ':' .. sep ..
|
||||
\ partial .. "\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_match(full, @:)
|
||||
|
||||
" Implicit drive letter
|
||||
call feedkeys(':' .. cmd .. ' ' .. sep .. partial .. "\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_match('/' .. dir .. '/', @:)
|
||||
|
||||
" UNC path
|
||||
call feedkeys(':' .. cmd .. ' ' .. sep .. sep .. $COMPUTERNAME .. sep ..
|
||||
\ drive .. '$' .. sep .. partial .."\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_match('//' .. $COMPUTERNAME .. '/' .. drive .. '$/' .. dir .. '/' , @:)
|
||||
|
||||
endfor
|
||||
endfor
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func Test_cd_unknown_dir()
|
||||
|
||||
@@ -4106,7 +4106,8 @@ func Test_isabsolutepath()
|
||||
call assert_true(isabsolutepath('A:\Foo'))
|
||||
call assert_true(isabsolutepath('A:/Foo'))
|
||||
call assert_false(isabsolutepath('A:Foo'))
|
||||
call assert_false(isabsolutepath('\Windows'))
|
||||
call assert_true(isabsolutepath('\Windows'))
|
||||
call assert_true(isabsolutepath('/Windows'))
|
||||
call assert_true(isabsolutepath('\\Server2\Share\Test\Foo.txt'))
|
||||
else
|
||||
call assert_true(isabsolutepath('/'))
|
||||
|
||||
Reference in New Issue
Block a user