weasel
weasel copied to clipboard
输入拼音但是不按空格提交的, 这时候使用快捷键切换ascii_mode不能在切换的时候直接上屏拼音
喜欢用ctrl+空格来切换中英文, 配置了切换ascii_mode
key_binder:
bindings:
- { when: always, accept: Control+space, toggle: ascii_mode }
没有打字的时候切换是没问题的,
但是打了几个拼音不提交,按Control+space切换的时候, 拼音处于有下划点的状态.需要按Enter上屏:
微软拼音输入法在这个情况下是直接上屏未提交的英文的.
加一行按键绑定,前两天自己琢磨出来的
key_binder:
bindings:
- { when: always, accept: Control+space, toggle: ascii_mode }
- { when: composing, accept: "Control+space", send: Return } # Ctrl+空格,触发回车键(Return)功能
https://github.com/rime/weasel/issues/717#issuecomment-1464936922 我用上面链接里的方法“关闭禁用输入法”的功能后,发现在composing状态下是能上屏了,但不会切换中英文,怎么解决。
把Control+space原本的快捷键删掉, 然后依据教程自行添加以下lua脚本
-- toggle_ascii.lua
local toggle_ascii = {}
function toggle_ascii.init(env)
end
function toggle_ascii.func(key, env)
local engine = env.engine
local context = env.engine.context
if not key:release()
and (key:repr() == "Control+space")
then
local target_state = not context:get_option("ascii_mode")
if context:is_composing() then
context:clear_non_confirmed_composition()
context:commit()
end
context:set_option("ascii_mode", target_state)
return 1
end
return 2
end
return toggle_ascii