From bf863a9edb8ffca653b13bc3c1c8e1ee71c9a051 Mon Sep 17 00:00:00 2001 From: mirtlecn Date: Sun, 28 Jul 2024 01:20:52 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=AE=80=E5=8C=96=20en=5Fspacer=20?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/en_spacer.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lua/en_spacer.lua b/lua/en_spacer.lua index ae368a5..b416d49 100644 --- a/lua/en_spacer.lua +++ b/lua/en_spacer.lua @@ -1,11 +1,11 @@ --- 中文或者英文后,再输入英文单词自动添加空格 +-- 英文后,再输入英文单词(必须为候选项)自动添加空格 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 - not latest_text:find( '[%p%s。,;?:—!《》‘’“”、¥…()【】「」『』]$' ) then + latest_text:find( '^ ?[%a\']+[%a\']*$' ) then cand = cand:to_shadow_candidate( 'en_spacer', cand.text:gsub( '(%a+\'?%a*)', ' %1' ), cand.comment ) end yield( cand ) @@ -13,4 +13,3 @@ function F.func( input, env ) end return F -