fix lua 降低英语单词顺序的逻辑 #147
This commit is contained in:
parent
32cbf184af
commit
272c70694d
14
rime.lua
14
rime.lua
@ -199,17 +199,19 @@ function reduce_english_filter(input, env)
|
|||||||
-- filter start
|
-- filter start
|
||||||
local code = env.engine.context.input
|
local code = env.engine.context.input
|
||||||
if env.words[code] then
|
if env.words[code] then
|
||||||
local first_cand
|
local pending_cands = {}
|
||||||
local index = 0
|
local index = 0
|
||||||
for cand in input:iter() do
|
for cand in input:iter() do
|
||||||
index = index + 1
|
index = index + 1
|
||||||
if first_cand then
|
if string.lower(cand.text) == code then
|
||||||
yield(cand)
|
table.insert(pending_cands, cand)
|
||||||
else
|
else
|
||||||
first_cand = cand
|
yield(cand)
|
||||||
end
|
end
|
||||||
if index >= env.idx then
|
if index >= env.idx + #pending_cands - 1 then
|
||||||
yield(first_cand)
|
for _, cand in ipairs(pending_cands) do
|
||||||
|
yield(cand)
|
||||||
|
end
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -98,7 +98,11 @@ reduce_english_filter:
|
|||||||
# 降低到第 idx 个位置
|
# 降低到第 idx 个位置
|
||||||
idx: 2
|
idx: 2
|
||||||
# 要降低的单词,匹配的是输入码,即全小写。
|
# 要降低的单词,匹配的是输入码,即全小写。
|
||||||
words: [rug, bus, ship, laos, bail, bam, bans, bib, bos, chic, chit, dab, dag, dal, dit, dub, dug, fab, gam, ger, gus, hem, hep, hud, kat, lam, lax, lex, lug, lux, moc, mos, mot, mum, nad, nay, nib, nip, pak, pap, pax, rig, rum, sac, sal, sax, sec, shin, sis, ska, slang, sus, tad, taj, tac, tic, yep, yum]
|
words: [rug, bus, ship, laos, bail, bam, bans, bib, bos, chic, chit, dab, dag,
|
||||||
|
dal, dit, dub, dug, fab, gam, ger, gus, hem, hep, hud, kat, lam, lax, lex, lug,
|
||||||
|
lux, moc, mos, mot, mum, nad, nay, nib, nip, pak, pap, pax, rig, rum, sac, sal,
|
||||||
|
sax, sec, shin, sis, ska, slang, sus, tad, taj, tac, tic, yep, yum, fax, cain,
|
||||||
|
key, mob, buy]
|
||||||
|
|
||||||
|
|
||||||
# 从 default 继承快捷键
|
# 从 default 继承快捷键
|
||||||
|
Loading…
x
Reference in New Issue
Block a user