From 3765afb7c84d3b73643d077de11f6f76282100d5 Mon Sep 17 00:00:00 2001 From: amzxyz Date: Wed, 31 Dec 2025 23:15:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=8B=B1=E6=96=87=E5=90=8E=E7=AC=A6?= =?UTF-8?q?=E5=8F=B7,.!=3F=E5=90=8E=E9=9D=A2=E8=BE=93=E5=85=A5=E4=B9=9F?= =?UTF-8?q?=E8=83=BD=E8=87=AA=E5=8A=A8=E5=8A=A0=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/super_filter.lua | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lua/super_filter.lua b/lua/super_filter.lua index dcb4279..049763b 100644 --- a/lua/super_filter.lua +++ b/lua/super_filter.lua @@ -600,9 +600,20 @@ function M.init(env) if env.engine and env.engine.context then env.commit_notifier = env.engine.context.commit_notifier:connect(function(ctx) local commit_text = ctx:get_commit_text() - -- 1. 判断上屏内容是否为英文短语 - env.prev_commit_is_eng = is_ascii_phrase_fast(commit_text) - -- 2. 上屏后,立即清除打断信号 + -- 判断是不是常规的英文单词 + local is_eng = is_ascii_phrase_fast(commit_text) + -- 如果不是单词,再检查是不是单独的英文标点 + if not is_eng then + -- 去掉末尾可能的空格,防止影响判断 + local clean = commit_text:gsub("%s+$", "") + -- 如果是 逗号、句号、感叹号、问号,也强行算作英文 + if clean == "," or clean == "." or clean == "!" or clean == "?" then + is_eng = true + end + end + -- 更新状态 + env.prev_commit_is_eng = is_eng + -- 屏后,立即清除打断信号 ctx:set_property("english_spacing", "") end) end