fix(snip): engine wordtrig edge case

This commit is contained in:
arne314
2025-09-17 12:32:37 +02:00
parent f54b288300
commit 472eaf4d72

View File

@@ -106,9 +106,10 @@ function M.engine(trigger, opts)
if not M.snippets_toggle or not condition() then return nil end if not M.snippets_toggle or not condition() then return nil end
local first_idx = 1 local first_idx = 1
if max_length ~= nil then if max_length ~= nil then
first_idx = #line_full - max_length -- include additional char for wordtrig -- include additional char for wordtrig
first_idx = #line_full - max_length
if first_idx < 1 then if first_idx < 1 then
if is_fixed_length then if is_fixed_length and first_idx < 0 then
return nil return nil
else else
first_idx = 1 first_idx = 1