-
Notifications
You must be signed in to change notification settings - Fork 43
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
怎样实现中英文之间自动加空格 #238
Comments
在engine/filters local F={}
function F.init(env)
env.size=20
env.history={}
env.notifier= env.engine.context.commit_notifier:connect( function(ctx)
for i=env.size, #env.history do
env.history[i] = nil
end
table.insert( env.history, 1, ctx:get_selected_candidate().text)
end)
end
function F.fini(env)
env.notifier:disconnect()
end
function F.tag_match(seg, env)
-- return env.engine.context:get_option('auto_space") -- 可以加上開關
return true
end
function F.func(inp,env)
local pre_space = ""
if env.history[1] and not env.history[1]:find(" $") then
pre_space= " "
end
for cand in inp:iter() do
if #cand.text == utf8.len(cand.txt) then -- 英文候選加空白
cand.text = pre_space .. cand.text .. " "
end
yield( cand )
end
end
return F |
非常感谢!我在 schema 里最后加上 |
是否有可能给 |
可以耶, 測試狀態,但是 在notifier func 中,加入 engine:commit_text( "--") 會 你可參考 librime rime/candidate.h librime-lua src/typess.cc CandidateReg set_xxxxx 會檢查 Candidate 型別 |
然而中英文之间不应该有空格 |
考虑以下几种方式
有哪些接口可能有帮助?
The text was updated successfully, but these errors were encountered: