feat: eat backspace, if it's held from the time when composing #1641#1644
Closed
fxliang wants to merge 1 commit intorime:masterfrom
Closed
feat: eat backspace, if it's held from the time when composing #1641#1644fxliang wants to merge 1 commit intorime:masterfrom
fxliang wants to merge 1 commit intorime:masterfrom
Conversation
e064df1 to
058e995
Compare
Member
|
代码复杂,看不懂。 |
Contributor
Author
如果可以更好啊 |
Contributor
Author
|
简单点用librime-lua插件实现算了,在前端上实现有点硬编了 local function init(env)
env.held_backspace_when_composing = false
env.XK_BackSpace = 0xff08
end
local function processor(key, env)
local ctx = env.engine.context
if key.keycode == env.XK_BackSpace then
if key:release() then -- 按键释放
env.held_backspace_when_composing = false
elseif key.modifier == 0 then -- 无组合键
if ctx:is_composing() then env.held_backspace_when_composing = true
elseif env.held_backspace_when_composing then return 1 -- 返回 kAccepted
end
end
end
return 2 -- 返回 kNoop
end
return {init = init, func = processor}在方案中添加processor, 具体准确的位置自行根据需要调整 'engine/processors/@before 2': lua_processor@*backspace |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #1641
not worked for Edge, chrome/firefox not tested yet.