lua: 调整 v 模式数字 Emoji 在候选项中的顺序

This commit is contained in:
Dvel 2023-02-10 19:27:29 +08:00
parent b66df47d1c
commit 8b02ffe904

View File

@ -196,9 +196,17 @@ function v_filter(input, env)
local code = env.engine.context.input -- 当前编码
local l = {}
for cand in input:iter() do
if (cand.text == "Vs.") then -- 特殊情况处理
-- 特殊情况处理
if (cand.text == "Vs.") then
yield(cand)
end
-- 特殊情况处理
local arr = {"1", "2", "3", "4", "5", "6", "7", "8", "9"}
for _, v in ipairs(arr) do
if (v == cand.text and string.len(code) == 2 and string.find(code, "v") == 1) then
yield(cand)
end
end
-- 以 v 开头、2 个长度的编码、候选项为单个字符的,提到前面来。
if (string.len(code) == 2 and string.find(code, "v") == 1 and utf8.len(cand.text) == 1) then
yield(cand)