Fixing annoying edge cases

This commit is contained in:
Alex Yatskov 2015-08-05 20:13:07 +09:00
parent 72668838bc
commit 7fe27fa7ca

View File

@ -84,7 +84,9 @@ function! argwrap#extractContainerArgText(range)
if l:extractStart < l:extractEnd if l:extractStart < l:extractEnd
let l:extract = l:lineText[l:extractStart : l:extractEnd - 1] let l:extract = l:lineText[l:extractStart : l:extractEnd - 1]
let l:text .= substitute(l:extract, '^\s*\(.\{-}\)\s*$', '\1 ', '') let l:extract = substitute(l:extract, '^\s*\(.\{-}\)\s*$', '\1', '')
let l:extract = substitute(l:extract, ',$', ', ', '')
let l:text .= l:extract
endif endif
endfor endfor
@ -121,14 +123,20 @@ function! argwrap#extractContainerArgs(text)
call argwrap#updateScope(l:stack, l:char) call argwrap#updateScope(l:stack, l:char)
if len(l:stack) == 0 && l:char == ',' if len(l:stack) == 0 && l:char == ','
call add(l:arguments, argwrap#trimArgument(l:argument)) let l:argument = argwrap#trimArgument(l:argument)
if len(l:argument) > 0
call add(l:arguments, l:argument)
endif
let l:argument = '' let l:argument = ''
else else
let l:argument .= l:char let l:argument .= l:char
endif endif
endfor endfor
call add(l:arguments, argwrap#trimArgument(l:argument)) let l:argument = argwrap#trimArgument(l:argument)
if len(l:argument) > 0
call add(l:arguments, l:argument)
endif
endif endif
return l:arguments return l:arguments