mirror of
https://github.com/ilyakooo0/nvim-autopairs.git
synced 2024-09-11 07:15:44 +03:00
fix: is_end_line function
This commit is contained in:
parent
5a86b4f83c
commit
e3e105b11a
@ -191,8 +191,9 @@ end
|
||||
cond.is_end_line = function()
|
||||
return function(opts)
|
||||
log.debug('is_end_line')
|
||||
-- if the next char is blank
|
||||
if opts.next_char ~= "" and opts.next_char:match("%s+") == nil then
|
||||
local end_text = opts.line:sub(opts.col + 1)
|
||||
-- end text is blank
|
||||
if end_text ~= "" and end_text:match("^%s+$") == nil then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
@ -17,8 +17,17 @@ local data = {
|
||||
filetype = "lua",
|
||||
linenr = 5,
|
||||
key = [[<cr>]],
|
||||
before = [[function a()| ]],
|
||||
after = [[ end ]]
|
||||
before = [[function a()| ]],
|
||||
after = [[ end ]]
|
||||
},
|
||||
{
|
||||
name = "lua function add endwise" ,
|
||||
filepath = './tests/endwise/init.lua',
|
||||
filetype = "lua",
|
||||
linenr = 5,
|
||||
key = [[<cr>]],
|
||||
before = [[function a()|x ab ]],
|
||||
after = [[]]
|
||||
},
|
||||
{
|
||||
name = "add if endwise" ,
|
||||
|
Loading…
Reference in New Issue
Block a user