Merge pull request #36 from ches/multipart-with-appended-fix

End-of-line comments within a multipart block get uncommented when they shouldn't
This commit is contained in:
Martin Grenfell 2011-05-05 18:42:11 -07:00
commit 4e5456522d

View File

@ -1394,6 +1394,12 @@ endfunction
function s:UncommentLineNormal(line)
let line = a:line
"get the positions of all delim types on the line
let indxLeft = s:FindDelimiterIndex(s:Left(), line)
let indxLeftAlt = s:FindDelimiterIndex(s:Left({'alt': 1}), line)
let indxRight = s:FindDelimiterIndex(s:Right(), line)
let indxRightAlt = s:FindDelimiterIndex(s:Right({'alt': 1}), line)
"get the comment status on the line so we know how it is commented
let lineCommentStatus = s:IsCommentedOuttermost(s:Left(), s:Right(), s:Left({'alt': 1}), s:Right({'alt': 1}), line)
@ -1408,34 +1414,23 @@ function s:UncommentLineNormal(line)
"it is not properly commented with any delims so we check if it has
"any random left or right delims on it and remove the outtermost ones
else
"get the positions of all delim types on the line
let indxLeft = s:FindDelimiterIndex(s:Left(), line)
let indxLeftAlt = s:FindDelimiterIndex(s:Left({'alt': 1}), line)
let indxRight = s:FindDelimiterIndex(s:Right(), line)
let indxRightAlt = s:FindDelimiterIndex(s:Right({'alt': 1}), line)
"remove the outter most left comment delim
if indxLeft != -1 && (indxLeft < indxLeftAlt || indxLeftAlt == -1)
let line = s:RemoveDelimiters(s:Left(), '', line)
elseif indxLeftAlt != -1
elseif indxLeftAlt != -1 && g:NERDRemoveAltComs
let line = s:RemoveDelimiters(s:Left({'alt': 1}), '', line)
endif
"remove the outter most right comment delim
if indxRight != -1 && (indxRight < indxRightAlt || indxRightAlt == -1)
let line = s:RemoveDelimiters('', s:Right(), line)
elseif indxRightAlt != -1
elseif indxRightAlt != -1 && g:NERDRemoveAltComs
let line = s:RemoveDelimiters('', s:Right({'alt': 1}), line)
endif
endif
let indxLeft = s:FindDelimiterIndex(s:Left(), line)
let indxLeftAlt = s:FindDelimiterIndex(s:Left({'alt': 1}), line)
let indxLeftPlace = s:FindDelimiterIndex(g:NERDLPlace, line)
let indxRightPlace = s:FindDelimiterIndex(g:NERDRPlace, line)
let indxRightAlt = s:FindDelimiterIndex(s:Right({'alt': 1}), line)
let indxRightPlace = s:FindDelimiterIndex(g:NERDRPlace, line)
let right = s:Right()