comparison autoload/vimcrosoft.vim @ 7:ff4590b2503a

Fix handling of spaces in configs/platforms for autocomplete.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 24 Sep 2020 22:55:56 -0700
parents 376f3371c311
children 096e80c13781
comparison
equal deleted inserted replaced
6:376f3371c311 7:ff4590b2503a
344 make 344 make
345 endif 345 endif
346 endfunction 346 endfunction
347 347
348 function! vimcrosoft#set_config_platform(configplatform) 348 function! vimcrosoft#set_config_platform(configplatform)
349 let l:bits = split(a:configplatform, '|') 349 let l:bits = split(substitute(a:configplatform, '\\ ', ' ', 'g'), '|')
350 if len(l:bits) != 2 350 if len(l:bits) != 2
351 call vimcrosoft#throw("Expected a value of the form: Config|Platform") 351 call vimcrosoft#throw("Expected a value of the form: Config|Platform")
352 endif 352 endif
353 353
354 let g:vimcrosoft_current_config = l:bits[0] 354 let g:vimcrosoft_current_config = l:bits[0]
391 \{idx, val -> val =~? l:argpat}) 391 \{idx, val -> val =~? l:argpat})
392 return l:projnames 392 return l:projnames
393 endfunction 393 endfunction
394 394
395 function! vimcrosoft#complete_current_sln_config_platforms(ArgLead, CmdLine, CursorPos) 395 function! vimcrosoft#complete_current_sln_config_platforms(ArgLead, CmdLine, CursorPos)
396 let l:argpat = '^'.substitute(a:ArgLead, '\', '', 'g')
396 let l:cfgplats = vimcrosoft#get_sln_config_platforms() 397 let l:cfgplats = vimcrosoft#get_sln_config_platforms()
397 let l:argpat = '^'.substitute(a:ArgLead, '\', '', 'g') 398 let l:cfgplats_filtered = filter(l:cfgplats, {idx, val -> val =~? l:argpat})
398 let l:cfgplatnames = filter(l:cfgplats, 399 call map(l:cfgplats_filtered, {idx, val -> escape(val, ' ')})
399 \{idx, val -> val =~? l:argpat}) 400 return l:cfgplats_filtered
400 return l:cfgplatnames
401 endfunction 401 endfunction
402 402
403 " }}} 403 " }}}
404 404
405 " {{{ Statusline Functions 405 " {{{ Statusline Functions