Cleanup
This commit is contained in:
parent
7c105a37c2
commit
351f0f3183
@ -45,18 +45,18 @@ local function find_brace_alt(brace)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function escape_brace(brace)
|
|
||||||
if brace == '[' or brace == ']' then
|
|
||||||
return '\\' .. brace
|
|
||||||
else
|
|
||||||
return brace
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function find_brace_range(brace)
|
local function find_brace_range(brace)
|
||||||
local brace_alt, _ = find_brace_alt(brace)
|
local brace_alt, _ = find_brace_alt(brace)
|
||||||
assert(brace_alt)
|
assert(brace_alt)
|
||||||
|
|
||||||
|
local escape_brace = function(brace_raw)
|
||||||
|
if brace_raw == '[' or brace_raw == ']' then
|
||||||
|
return '\\' .. brace_raw
|
||||||
|
else
|
||||||
|
return brace_raw
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
---@diagnostic disable-next-line: param-type-mismatch
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
local row1, col1 = unpack(vim.fn.searchpairpos(escape_brace(brace), '', escape_brace(brace_alt), 'Wnb', is_string_literal))
|
local row1, col1 = unpack(vim.fn.searchpairpos(escape_brace(brace), '', escape_brace(brace_alt), 'Wnb', is_string_literal))
|
||||||
if row1 > 0 and col1 > 0 then
|
if row1 > 0 and col1 > 0 then
|
||||||
|
Loading…
Reference in New Issue
Block a user