fix #1858
This commit is contained in:
@@ -69,6 +69,16 @@ misc.empty = function(v)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Search value in table
|
||||||
|
misc.contains = function(tbl, v)
|
||||||
|
for _, value in ipairs(tbl) do
|
||||||
|
if value == v then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
---The symbol to remove key in misc.merge.
|
---The symbol to remove key in misc.merge.
|
||||||
misc.none = vim.NIL
|
misc.none = vim.NIL
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
local misc = require('cmp.utils.misc')
|
||||||
|
|
||||||
local P = {}
|
local P = {}
|
||||||
|
|
||||||
---Take characters until the target characters (The escape sequence is '\' + char)
|
---Take characters until the target characters (The escape sequence is '\' + char)
|
||||||
@@ -17,14 +19,14 @@ P.take_until = function(targets, specials)
|
|||||||
table.insert(raw, '\\')
|
table.insert(raw, '\\')
|
||||||
new_pos = new_pos + 1
|
new_pos = new_pos + 1
|
||||||
c = string.sub(input, new_pos, new_pos)
|
c = string.sub(input, new_pos, new_pos)
|
||||||
if not vim.list_contains(targets, c) and not vim.list_contains(specials, c) then
|
if not misc.contains(targets, c) and not misc.contains(specials, c) then
|
||||||
table.insert(esc, '\\')
|
table.insert(esc, '\\')
|
||||||
end
|
end
|
||||||
table.insert(raw, c)
|
table.insert(raw, c)
|
||||||
table.insert(esc, c)
|
table.insert(esc, c)
|
||||||
new_pos = new_pos + 1
|
new_pos = new_pos + 1
|
||||||
else
|
else
|
||||||
if vim.list_contains(targets, c) then
|
if misc.contains(targets, c) then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
table.insert(raw, c)
|
table.insert(raw, c)
|
||||||
|
|||||||
Reference in New Issue
Block a user