-
Notifications
You must be signed in to change notification settings - Fork 589
[Feature request] 在预编辑区内移动光标时,使光标不要循环移动 #993
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
Labels
Comments
trime 可以綁定 空白 左右滑動 == 方向鍵吧 |
是这样,但由于光标会循环移动,很难快速把光标移回末尾,一不小心就移过头了。 |
前端 8000 以控制,或者写一下lua拦截。 |
-- lua/navigator.lua
-- 替換 engine/processors/lnavigator --> lua_processor@*navigator
local M = {}
function M.init(env)
local ctx = env.engine.context
if ctx:get_option("_horizontal") then
-- 候選橫排
env.left = KeyEvent("Up")
env.right= KeyEvent("Down")
else
--候選直排
env.left = KeyEvent("Left")
env.right= KeyEvent("Right")
end
env.processor = Component.Processor(env.engine, "processor", "navigator") -- <-- 這行
end
function M.fini(env)
end
function M.func(key, env)
local ctx = env.engine.context
if ctx:is_composing() then
if ( key:eq(env.left) and ctx.caret_pos == 0 ) or
(key:eq(env.right) and ctx.caret_pos == #ctx.input) then
return 1 -- accepted ( 最左 最右 不再移動)
end
return env.processor:process_key_event(key) -- <-- 這行
end
return 2 -- Noop
end
return M |
另一個script是移除 env.processor |
感谢你提供的脚本。
|
5A43
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
目前,当预编辑区内光标处于最右侧时,再按下右方向键,光标会移动到最左侧,反之亦然。
但是,这个机制在手机上会造成一些麻烦,因为不存在方向键及 HOME、END,手机输入法一般会采用滑动空格键的方式来移动光标。因此,当修改句中拼音后,难以快速将光标移回预编辑区的最右侧。
Describe the solution you'd like
修改默认机制或增加一个选项,禁用光标的循环移动。
Describe alternatives you've considered
如能实现 #876 中描述的功能,也能解决我目前遇到的困境。
The text was updated successfully, but these errors were encountered: