Fixed s:GetCommentEnd(), s:EndCommentExpr()

Also fixed s:ConvertDelimiterToSeparator() such that it doesn't mess up
the end comment and draws the border before it.
This commit is contained in:
Dhruva Sagar
2013-05-18 03:34:02 +05:30
parent 9ff1b37210
commit 4606d9c637

View File

@@ -104,7 +104,7 @@ endfunction
function! s:GetCommentEnd() "{{{2 function! s:GetCommentEnd() "{{{2
let cstring = &commentstring let cstring = &commentstring
if s:Strlen(cstring) > 0 if s:Strlen(cstring) > 0
let cst = split(cstring, '%') let cst = split(cstring, '%s')
if len(cst) == 2 if len(cst) == 2
return substitute(cst[1], '.', '\\\0', 'g') return substitute(cst[1], '.', '\\\0', 'g')
else else
@@ -149,7 +149,7 @@ endfunction
function! s:EndCommentExpr() "{{{2 function! s:EndCommentExpr() "{{{2
let cendexpr = s:GetCommentEnd() let cendexpr = s:GetCommentEnd()
if s:Strlen(cendexpr) > 0 if s:Strlen(cendexpr) > 0
return '.*\zs\s*' . cendexpr . '\s*$' return '.*\zs\s\+' . cendexpr . '\s*$'
else else
return '' return ''
endif endif
@@ -242,7 +242,7 @@ function! s:ConvertDelimiterToSeparator(line, ...) "{{{2
if delim ==# ',' if delim ==# ','
silent! execute a:line . 's/' . "[\'\"][^\'\"]*\\zs,\\ze[^\'\"]*[\'\"]/__COMMA__/g" silent! execute a:line . 's/' . "[\'\"][^\'\"]*\\zs,\\ze[^\'\"]*[\'\"]/__COMMA__/g"
endif endif
silent! execute a:line . 's/' . s:StartExpr() . '\zs\ze.\|' . delim . '\|$/' . silent! execute a:line . 's/' . s:StartExpr() . '\zs\ze.\|' . delim . '\|.\zs\ze' . s:EndExpr() . '/' .
\ g:table_mode_separator . '/g' \ g:table_mode_separator . '/g'
if delim ==# ',' if delim ==# ','
silent! execute a:line . 's/' . "[\'\"][^\'\"]*\\zs__COMMA__\\ze[^\'\"]*[\'\"]/,/g" silent! execute a:line . 's/' . "[\'\"][^\'\"]*\\zs__COMMA__\\ze[^\'\"]*[\'\"]/,/g"