mirror of
https://github.com/Ascyii/typstar.git
synced 2026-01-01 13:34:24 -05:00
fix(snip): unicode matching problems
This commit is contained in:
@@ -91,7 +91,15 @@ function M.engine(trigger, opts)
|
|||||||
-- matching
|
-- matching
|
||||||
return function(line, trig)
|
return function(line, trig)
|
||||||
if not M.snippets_toggle or not condition() then return nil end
|
if not M.snippets_toggle or not condition() then return nil end
|
||||||
if fixed_length ~= nil then line = line:sub(#line - fixed_length) end
|
if fixed_length ~= nil then
|
||||||
|
local first_idx = #line - fixed_length -- include additional char for wordtrig
|
||||||
|
if first_idx < 0 then
|
||||||
|
return nil
|
||||||
|
elseif first_idx > 0 then
|
||||||
|
if string.byte(line, first_idx) > 127 then return nil end
|
||||||
|
end
|
||||||
|
line = line:sub(first_idx)
|
||||||
|
end
|
||||||
local whole, captures = base_engine(line, trig)
|
local whole, captures = base_engine(line, trig)
|
||||||
if whole == nil then return nil end
|
if whole == nil then return nil end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user