|
817 | 817 |
|
818 | 818 | function! s:CommentBlock(beg, end, cbeg, cend, comment_mode, comment_do, checkRx, cdef) abort
|
819 | 819 | Tlibtrace 'tcomment', a:beg, a:end, a:cbeg, a:cend, a:comment_do, a:checkRx, a:cdef
|
820 |
| - let indentStr = repeat(' ', a:cbeg) |
821 | 820 | let t = @t
|
822 | 821 | let sel_save = &selection
|
823 | 822 | set selection=exclusive
|
@@ -874,9 +873,13 @@ function! s:CommentBlock(beg, end, cbeg, cend, comment_mode, comment_do, checkRx
|
874 | 873 | endif
|
875 | 874 | endif
|
876 | 875 | else
|
| 876 | + let indentStr = repeat(' ', a:cbeg) |
| 877 | + if &expandtab == 0 |
| 878 | + let indentStr = substitute(indentStr, repeat(' ', &tabstop), '\t', 'g') |
| 879 | + endif |
877 | 880 | let cs = indentStr . substitute(cs, '%\@<!%s', '%s'. indentStr, '')
|
878 | 881 | Tlibtrace 'tcomment', cs, ms
|
879 |
| - if !empty(ms) |
| 882 | + " if !empty(ms) |
880 | 883 | let lines = []
|
881 | 884 | let lnum = 0
|
882 | 885 | let indentlen = a:cbeg
|
@@ -905,7 +908,7 @@ function! s:CommentBlock(beg, end, cbeg, cend, comment_mode, comment_do, checkRx
|
905 | 908 | endif
|
906 | 909 | let @t = join(lines, "\n")
|
907 | 910 | Tlibtrace 'tcomment', 3, @t
|
908 |
| - endif |
| 911 | + " endif |
909 | 912 | let @t = tcomment#format#Printf1(cs, "\n". @t ."\n")
|
910 | 913 | Tlibtrace 'tcomment', 4, cs, @t, a:comment_mode
|
911 | 914 | if a:comment_mode =~# '#'
|
|
0 commit comments