9595function Op .linewise (param )
9696 local pattern = U .is_fn (param .cfg .ignore )
9797 local padding = U .is_fn (param .cfg .padding )
98- local check = U .is_commented (param .lcs , param .rcs , padding )
98+ local check_comment = U .is_commented (param .lcs , param .rcs , padding )
9999
100100 -- While commenting a region, there could be lines being both commented and non-commented
101101 -- So, if any line is uncommented then we should comment the whole block or vise-versa
102- local cmode = U .cmode .uncomment
102+ local cmode = U .cmode .comment
103103
104104 --- When commenting multiple line, it is to be expected that indentation should be preserved
105105 --- So, When looping over multiple lines we need to store the indentation of the mininum length (except empty line)
@@ -112,8 +112,8 @@ function Op.linewise(param)
112112 for _ , line in ipairs (param .lines ) do
113113 -- I wish lua had `continue` statement [sad noises]
114114 if not U .ignore (line , pattern ) then
115- if cmode == U .cmode .uncomment and param . cmode == U . cmode . toggle and ( not check ( line ) ) then
116- cmode = U .cmode .comment
115+ if cmode == U .cmode .comment and check_comment ( line ) then
116+ cmode = U .cmode .uncomment
117117 end
118118
119119 -- If local `cmode` == comment or the given cmode ~= uncomment, then only calculate min_indent
0 commit comments