mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-12 11:43:46 -05:00
s:CommentLinesSexy - Fixed issue #2 . Tabs now respected in sexy comments.
This commit is contained in:
@@ -1147,13 +1147,24 @@ function s:CommentLinesSexy(topline, bottomline)
|
|||||||
" add the left delimiter one line above the lines that are to be commented
|
" add the left delimiter one line above the lines that are to be commented
|
||||||
call cursor(a:topline, 1)
|
call cursor(a:topline, 1)
|
||||||
execute 'normal! O'
|
execute 'normal! O'
|
||||||
call setline(a:topline, repeat(' ', leftAlignIndx) . left )
|
|
||||||
|
" Make sure tabs are respected
|
||||||
|
if !&expandtab
|
||||||
|
let theLine = s:ConvertLeadingSpacesToTabs(theLine)
|
||||||
|
endif
|
||||||
|
call setline(a:topline, theLine)
|
||||||
|
|
||||||
" add the right delimiter after bottom line (we have to add 1 cos we moved
|
" add the right delimiter after bottom line (we have to add 1 cos we moved
|
||||||
" the lines down when we added the left delim
|
" the lines down when we added the left delim
|
||||||
call cursor(a:bottomline+1, 1)
|
call cursor(a:bottomline+1, 1)
|
||||||
execute 'normal! o'
|
execute 'normal! o'
|
||||||
call setline(a:bottomline+2, repeat(' ', leftAlignIndx) . repeat(' ', strlen(left)-strlen(sexyComMarker)) . right )
|
let theLine = repeat(' ', leftAlignIndx) . repeat(' ', strlen(left)-strlen(sexyComMarker)) . right
|
||||||
|
|
||||||
|
" Make sure tabs are respected
|
||||||
|
if !&expandtab
|
||||||
|
let theLine = s:ConvertLeadingSpacesToTabs(theLine)
|
||||||
|
endif
|
||||||
|
call setline(a:bottomline+2, theLine)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user