@@ -442,7 +442,7 @@ endfunction
442
442
443
443
function ! s: file_complete (A) abort
444
444
return map (split (glob (substitute (a: A , ' .\@<=\ze[\\/]\|$' , ' *' , ' g' )), " \n " ),
445
- \ ' isdirectory(v:val) ? v:val . dispatch#slash() : v:val' )
445
+ \ ' fnameescape( isdirectory(v:val) ? v:val . dispatch#slash() : v:val) ' )
446
446
endfunction
447
447
448
448
function ! s: compiler_complete (compiler , A, L, P ) abort
@@ -477,12 +477,13 @@ function! s:compiler_complete(compiler, A, L, P) abort
477
477
endfunction
478
478
479
479
function ! dispatch#command_complete (A, L, P ) abort
480
- let args = matchstr (a: L , ' \s\zs.*' )
480
+ let L = strpart (a: L , 0 , a: P )
481
+ let args = matchstr (L, ' \s\zs.*' )
481
482
let [cmd, opts] = s: extract_opts (args )
482
- let P = a: P + len (cmd) - len (a: L )
483
+ let P = a: P + len (cmd) - len (L)
483
484
let len = matchend (cmd, ' \S\+\s' )
484
485
if len >= 0 && P >= 0
485
- let args = matchstr (a: L , ' \s\zs.*' )
486
+ let args = matchstr (L, ' \s\zs.*' )
486
487
let compiler = get (opts, ' compiler' , dispatch#compiler_for_program (cmd))
487
488
let cd = exists (' *haslocaldir' ) && haslocaldir () ? ' lcd' : ' cd'
488
489
try
0 commit comments