Skip to content

Commit 0580353

Browse files
committed
fix: return boolean from utils.is_commented
1 parent f360925 commit 0580353

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lua/Comment/utils.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,23 +332,24 @@ function U.is_commented(left, right, padding, scol, ecol)
332332
if type(line) == 'table' then
333333
local first, last = line[1], line[#line]
334334
if is_full then
335-
return string.find(first, ll) and string.find(last, rr)
335+
return (string.find(first, ll) and string.find(last, rr)) ~= nil
336336
end
337-
return string.find(string.sub(first, scol + 1, -1), ll) and string.find(string.sub(last, 0, ecol + 1), rr)
337+
return (string.find(string.sub(first, scol + 1, -1), ll) and string.find(string.sub(last, 0, ecol + 1), rr))
338+
~= nil
338339
end
339340

340341
------------------
341342
-- for linewise --
342343
------------------
343344
if is_full then
344-
return string.find(line, pattern)
345+
return string.find(line, pattern) ~= nil
345346
end
346347

347348
--------------------------------
348349
-- for current-line blockwise --
349350
--------------------------------
350351
-- SOURCE: https://github.com/numToStr/Comment.nvim/issues/224
351-
return string.find(string.sub(line, scol + 1, (ecol > #line and #line or ecol + 1)), pattern)
352+
return string.find(string.sub(line, scol + 1, (ecol > #line and #line or ecol + 1)), pattern) ~= nil
352353
end
353354
end
354355

0 commit comments

Comments
 (0)