fix: afterquote

It will better it is automatic add pair for quote when only have quote
in line some kind of noisy because we can remove map pair easy
This commit is contained in:
windwp 2021-07-19 11:15:46 +07:00
parent e599e15f94
commit b0bbe8d908
2 changed files with 3 additions and 2 deletions

View File

@ -431,7 +431,7 @@ M.autopairs_afterquote = function(line, key_char)
and not utils.is_in_quote(line, col, next_char)
then
local is_prev_slash = false
for i = col + 2 + #next_char, #line, 1 do
for i = #line - 2, #line, 1 do
local char = line:sub(i, i + #next_char - 1)
local char_end = line:sub(i + 1, i + #next_char)
if not is_prev_slash and char == next_char then

View File

@ -5,6 +5,7 @@ _G.npairs = npairs
npairs.setup({
enable_afterquote = true,
})
local data = {
{
name = 'add bracket after quote ',
@ -88,7 +89,7 @@ local data = {
linenr = '5',
key = [[(]],
before = [[|"data", "abcdef"]],
after = [[(|"data", "abcdef"]],
after = [[(|"data", "abcdef")]],
},
}