mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-02-27 12:52:10 +08:00
Fix removing space when uncommenting spaced AltDelims multipart comment (#286)
This commit is contained in:
parent
607253203d
commit
c5f8cbf70d
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user