From 095630890883eee0559c3b6acd0a6f936cd13ae9 Mon Sep 17 00:00:00 2001 From: Dvel Date: Tue, 6 Feb 2024 18:19:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20'%'=20=E6=84=8F=E5=A4=96=E4=B8=8D?= =?UTF-8?q?=E4=B8=8A=E5=B1=8F=20=20fix=20#668?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/pin_cand_filter.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/pin_cand_filter.lua b/lua/pin_cand_filter.lua index 9482849..93b5832 100644 --- a/lua/pin_cand_filter.lua +++ b/lua/pin_cand_filter.lua @@ -108,12 +108,6 @@ function M.init(env) end function M.func(input, env) - -- If there is no configuration, no filtering will be performed - if not M.pin_cands then - for cand in input:iter() do yield(cand) end - return - end - -- 当前输入框的 preedit,未经过方案 translator/preedit_format 转换 -- 输入 nihaoshij 则为 nihaoshij,选择了「你好」后变成 你好shij local full_preedit = env.engine.context:get_preedit().text @@ -122,6 +116,12 @@ function M.func(input, env) -- 是否正在选词(已经选择了至少一个字词,如 `你好shij` 这种状态) -- local isSelecting = full_preedit ~= letter_only_preedit + -- If there is no configuration, no filtering will be performed + if not M.pin_cands or #letter_only_preedit == 0 then + for cand in input:iter() do yield(cand) end + return + end + local pined = {} -- 提升的候选项 local others = {} -- 其余候选项 local pined_count = 0