Fix edge-case string.find and string.gmatch differ

This commit is contained in:
Stephen Seo 2022-11-03 20:11:49 +09:00
parent 3c73a4438b
commit 62447a8c90

View file

@ -73,7 +73,7 @@ vim.g.quickcomment_togglecommentlines = function (line_start, line_end)
-- get lines to comment/uncomment -- get lines to comment/uncomment
local lines = vim.api.nvim_buf_get_lines(0, line_start, line_end, false) local lines = vim.api.nvim_buf_get_lines(0, line_start, line_end, false)
for i, line in ipairs(lines) do for i, line in ipairs(lines) do
if line:find(escaped_string) == nil then if line:find('^' .. escaped_string) == nil then
-- not commented, comment line -- not commented, comment line
lines[i] = comment_string:format(line) lines[i] = comment_string:format(line)
else else