fix(lua): avoid assigning to const for-loop variable for Lua 5.5 compat (#1517)

follow 18cb213d9f
This commit is contained in:
cccc
2026-03-31 12:15:11 +08:00
committed by GitHub
parent 5b8455b7e4
commit 48789c26d9
2 changed files with 8 additions and 6 deletions

View File

@@ -6,11 +6,12 @@ local F = {}
function F.func( input, env )
local latest_text = env.engine.context.commit_history:latest_text()
for cand in input:iter() do
if cand.text:match( '^[%a\']+[%a\']*$' ) and latest_text and #latest_text > 0 and
local c = cand
if c.text:match( '^[%a\']+[%a\']*$' ) and latest_text and #latest_text > 0 and
latest_text:find( '^ ?[%a\']+[%a\']*$' ) then
cand = cand:to_shadow_candidate( 'en_spacer', cand.text:gsub( '(%a+\'?%a*)', ' %1' ), cand.comment )
c = c:to_shadow_candidate( 'en_spacer', c.text:gsub( '(%a+\'?%a*)', ' %1' ), c.comment )
end
yield( cand )
yield( c )
end
end