mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-02-24 19:41:10 +08:00
Clean up duplicate code
This commit is contained in:
parent
38630ff5eb
commit
f98f73221c
@ -1394,6 +1394,12 @@ endfunction
|
|||||||
function s:UncommentLineNormal(line)
|
function s:UncommentLineNormal(line)
|
||||||
let line = a: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
|
"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)
|
let lineCommentStatus = s:IsCommentedOuttermost(s:Left(), s:Right(), s:Left({'alt': 1}), s:Right({'alt': 1}), line)
|
||||||
|
|
||||||
@ -1408,12 +1414,6 @@ function s:UncommentLineNormal(line)
|
|||||||
"it is not properly commented with any delims so we check if it has
|
"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
|
"any random left or right delims on it and remove the outtermost ones
|
||||||
else
|
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
|
"remove the outter most left comment delim
|
||||||
if indxLeft != -1 && (indxLeft < indxLeftAlt || indxLeftAlt == -1)
|
if indxLeft != -1 && (indxLeft < indxLeftAlt || indxLeftAlt == -1)
|
||||||
let line = s:RemoveDelimiters(s:Left(), '', line)
|
let line = s:RemoveDelimiters(s:Left(), '', line)
|
||||||
@ -1430,12 +1430,7 @@ function s:UncommentLineNormal(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 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 indxRightPlace = s:FindDelimiterIndex(g:NERDRPlace, line)
|
||||||
|
|
||||||
let right = s:Right()
|
let right = s:Right()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user