2024-07-27 19:20:52 +02:00
|
|
|
-- 英文后,再输入英文单词(必须为候选项)自动添加空格
|
2024-07-27 17:33:01 +02:00
|
|
|
local F = {}
|
2023-10-09 15:31:10 +02:00
|
|
|
|
2024-07-27 17:33:01 +02:00
|
|
|
function F.func( input, env )
|
|
|
|
local latest_text = env.engine.context.commit_history:latest_text()
|
2023-09-28 17:51:24 +02:00
|
|
|
for cand in input:iter() do
|
2024-07-27 17:33:01 +02:00
|
|
|
if cand.text:match( '^[%a\']+[%a\']*$' ) and latest_text and #latest_text > 0 and
|
2024-07-27 19:20:52 +02:00
|
|
|
latest_text:find( '^ ?[%a\']+[%a\']*$' ) then
|
2024-07-27 17:33:01 +02:00
|
|
|
cand = cand:to_shadow_candidate( 'en_spacer', cand.text:gsub( '(%a+\'?%a*)', ' %1' ), cand.comment )
|
2023-09-28 17:51:24 +02:00
|
|
|
end
|
2024-07-27 17:33:01 +02:00
|
|
|
yield( cand )
|
2023-09-28 17:51:24 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-07-27 17:33:01 +02:00
|
|
|
return F
|