We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
套用 rime/librime#248 的例子来说明:
-- Control+v 转大写,加空格 local function do_capital_space(s) return string.upper(s .. " ") end local function myproc(key, env) local engine = env.engine local context = engine.context local page_size = engine.schema.page_size --- accept: Control+v if (key:repr() == 'Control+v') then --- when: composing if (context:is_composing()) then local s_orig = context:get_commit_text() --- do_capital_space local s = do_capital_space(s_orig) .. ' <' .. key:repr() .. '>' engine:commit_text(s) context:clear() return 0 -- kAccepted end end return 2 -- kNoop end return myproc
方案配置:
... engine: processors: - ascii_composer - recognizer - lua_processor@myproc - key_binder - speller - punctuator - selector - navigator - express_editor ...
使用时,在选字状态下按 Ctrl + v,成功加了空格,但是也发生了粘贴操作。又如,将按键判断改为 key:repr() == '8',那么上屏时除加了空格以外,还会加个「8」。
key:repr() == '8'
The text was updated successfully, but these errors were encountered:
-- Control+v 转大写,加空格 local function do_capital_space(s) return string.upper(s .. " ") end local function myproc(key, env) local engine = env.engine local context = engine.context local page_size = engine.schema.page_size --- accept: Control+v if (key:repr() == 'Control+v') then --- when: composing if (context:is_composing()) then local s_orig = context:get_commit_text() --- do_capital_space local s = do_capital_space(s_orig) .. ' <' .. key:repr() .. '>' engine:commit_text(s) context:clear() return 0 -- kAccepted
是我打错了,返回 0 是拒绝,1 才是接受。 返回拒绝时,虽然我们已经处理过按键了,但系统以为没有,于是会按默认值再处理一遍。
end end return 2 -- kNoop end return myproc
end
end return 2 -- kNoop end
return myproc
Sorry, something went wrong.
谢谢,解决了。
No branches or pull requests
套用 rime/librime#248 的例子来说明:
方案配置:
使用时,在选字状态下按 Ctrl + v,成功加了空格,但是也发生了粘贴操作。又如,将按键判断改为
key:repr() == '8'
,那么上屏时除加了空格以外,还会加个「8」。The text was updated successfully, but these errors were encountered: