mirror of
https://github.com/iDvel/rime-ice.git
synced 2026-05-14 00:30:37 +08:00
lua & docs: 增加 is_in_user_dict 配置项; close #279
This commit is contained in:
@@ -1,8 +1,21 @@
|
||||
-- 为用户词典中(输入过)的内容结尾加上一个星号 *
|
||||
-- 根据是否在用户词典,在结尾加上一个星号 *
|
||||
-- is_in_user_dict: true 输入过的内容
|
||||
-- is_in_user_dict: flase 或不写 未输入过的内容
|
||||
local function is_in_user_dict(input, env)
|
||||
if not env.is_in_user_dict then
|
||||
local config = env.engine.schema.config
|
||||
env.name_space = env.name_space:gsub('^*', '')
|
||||
env.is_in_user_dict = config:get_bool(env.name_space)
|
||||
end
|
||||
for cand in input:iter() do
|
||||
if (string.find(cand.type, "user")) then
|
||||
cand.comment = cand.comment .. '*'
|
||||
if env.is_in_user_dict then
|
||||
if (string.find(cand.type, "user")) then
|
||||
cand.comment = cand.comment .. '*'
|
||||
end
|
||||
else
|
||||
if not (string.find(cand.type, "user")) then
|
||||
cand.comment = cand.comment .. '*'
|
||||
end
|
||||
end
|
||||
yield(cand)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user