-
Notifications
You must be signed in to change notification settings - Fork 573
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
如何修改已经输入的编码? #547
Labels
Comments
需要加一个API函数。我记得讨论过,现在看代码好像还没加。 |
希望大哥近期可以加一下这个API,以我的眼光,有这个API有几大实用之处:
|
|
取消上屏和九宮格輸入碼確認都需要UI支持,不適合通過lua處理 |
--解法1 使用 lua processor 清空原编码,插入新编码
processor=function(key,env)
local old_code=env.engine.context.input
local new_code=......
env.engine.context:clear()
env.engine.context:push_input(new_code)
return 1
end --解法2 根据用户给出的编码偏移量,在 lua translator 的 query 过程中将数字替换为对应的拼音编码
local spell={
{["1234"]="wo"},
{["1234"]="de"},
{["1234"]="shi"},
{["1234"]="jie"},
}
local base=#spell
local diff=0
processor=function(key,env)
if key:repr()=="x" then
diff=(diff+1)%base
end
return 2
end
translator=function(input,seg)
local query=tran:query(input:gsub("[0-9]+",spell[diff+1]),seg)
if not query then return end
for cand in query:iter() do
yield(cand)
end
end
-- 每按一次x,真实编码1234映射的 query 编码都会从wo-de-shi-jie这个序列中轮换 |
imfuxiao
added a commit
to imfuxiao/librime
that referenced
this issue
Dec 1, 2023
imfuxiao
added a commit
to imfuxiao/librime
that referenced
this issue
Dec 1, 2023
imfuxiao
added a commit
to imfuxiao/librime
that referenced
this issue
Dec 1, 2023
imfuxiao
added a commit
to imfuxiao/librime
that referenced
this issue
Dec 1, 2023
imfuxiao
added a commit
to imfuxiao/librime
that referenced
this issue
Dec 1, 2023
This was referenced Dec 1, 2023
imfuxiao
added a commit
to imfuxiao/librime
that referenced
this issue
Dec 7, 2023
lotem
pushed a commit
that referenced
this issue
Dec 17, 2023
groverlynn
pushed a commit
to groverlynn/librime
that referenced
this issue
Dec 19, 2023
fxliang
pushed a commit
to fxliang/librime
that referenced
this issue
Feb 2, 2024
graphemecluster
pushed a commit
to TypeDuck-HK/librime
that referenced
this issue
Mar 18, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
实际上是两个问题:
关联 hchunhui/librime-lua#170
The text was updated successfully, but these errors were encountered: