Skip to content

Commit

Permalink
Fix removing space when uncommenting spaced AltDelims multipart comme…
Browse files Browse the repository at this point in the history
…nt (#286)
  • Loading branch information
k33nice authored and alerque committed Feb 20, 2017
1 parent 6072532 commit c5f8cbf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugin/NERD_commenter.vim
Expand Up @@ -623,7 +623,7 @@ function s:AppendCommentToLine()

"stick the delimiters down at the end of the line. We have to format the
"comment with spaces as appropriate
execute ":normal! " . insOrApp . (isLineEmpty ? '' : ' ') . left . right
execute ":normal! " . insOrApp . (isLineEmpty ? '' : ' ') . left . right

" if there is a right delimiter then we gotta move the cursor left
" by the length of the right delimiter so we insert between the delimiters
Expand Down Expand Up @@ -1396,7 +1396,7 @@ function s:RemoveDelimiters(left, right, line)

"if the user has specified that there is a space before the right delimiter
"then check for the space and remove it if it is there
if delimsSpaced && strpart(line, rightIndx-s:lenSpaceStr, s:lenSpaceStr) == s:spaceStr && s:Multipart()
if delimsSpaced && strpart(line, rightIndx-s:lenSpaceStr, s:lenSpaceStr) == s:spaceStr && (s:Multipart() || s:AltMultipart())
let line = strpart(line, 0, rightIndx-s:lenSpaceStr) . strpart(line, rightIndx)
endif
endif
Expand All @@ -1418,7 +1418,7 @@ function s:SetupStateBeforeLineComment(topLine, bottomLine)
let state = {'foldmethod' : &foldmethod,
\'ignorecase' : &ignorecase}

" Vim's foldmethods are evaluated every time we use 'setline', which can
" Vim's foldmethods are evaluated every time we use 'setline', which can
" make commenting wide ranges of lines VERY slow. We'll change it to
" manual, do the commenting stuff and recover it later. To avoid slowing
" down commenting few lines, we avoid doing this for ranges smaller than
Expand Down Expand Up @@ -1623,7 +1623,7 @@ function s:UncommentLinesSexy(topline, bottomline)
let theLine = s:SwapOuterPlaceHoldersForMultiPartDelims(theLine)
call setline(bottomline, theLine)
endif

" remove trailing whitespaces for first and last line
if g:NERDTrimTrailingWhitespace == 1
let theLine = getline(a:bottomline)
Expand Down

0 comments on commit c5f8cbf

Please sign in to comment.