Merge pull request #21 from elythyr/fix-prefix-ending-with-space

fix: prefix ending with spaces
This commit is contained in:
Alex Yatskov 2020-06-06 15:13:35 -07:00 committed by GitHub
commit d52b2104e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,6 +68,7 @@ endfunction
function! argwrap#extractContainerArgText(range, linePrefix)
let l:text = ''
let l:trimPattern = printf('\m^\s*\(.\{-}\%%(%s\)\?\)\s*$', escape(a:linePrefix, '\$.*^['))
for l:lineIndex in range(a:range.lineStart, a:range.lineEnd)
let l:lineText = getline(l:lineIndex)
@ -84,7 +85,7 @@ function! argwrap#extractContainerArgText(range, linePrefix)
if l:extractStart < l:extractEnd
let l:extract = l:lineText[l:extractStart : l:extractEnd - 1]
let l:extract = substitute(l:extract, '^\s*\(.\{-}\)\s*$', '\1', '')
let l:extract = substitute(l:extract, l:trimPattern, '\1', '')
if stridx(l:extract, a:linePrefix) == 0
let l:extract = l:extract[len(a:linePrefix):]
endif