-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如何拦截即将上屏的字符串并修改他? #371
Comments
可以用 select_notifyer or commit_notifier(但要註冊在 engine 前) 但我覺的用 lua_filter 去修改 candidate 比較簡單 , local F ={}
function F.init(env)
env.tag= "t1"
end
function F.tags_match(seg,env)
return env.env.engine.context:get_option(xxx) or seg.tags[env.tag]
end
function F.fini(env)
end
function F.func(inp, env)
for cand in inp:iter() do
if ... then
....
yield( replace_cand)
else
yield(cand)
end
end
return F
|
如何在 engine 前注册 commit notifier?或 select notifier? 如何拦截消息让 engine 接收不到?如果用 lua filter 的话,会将候选项的显示效果造成影响。 |
你可以先查一下 wiki / script 說明 還有 已經排入候選的candidate 是無法 替換的 ,所以在 engine call OnCommit() 還是取用 原來的candidate.text , 除非是 SimpleCandidate 類 才可以更改text |
發送 select_notifier 是 selector 送出來的 |
如题
The text was updated successfully, but these errors were encountered: