improve rime.lua
This commit is contained in:
parent
558fcf7246
commit
82bcbbe332
18
rime.lua
18
rime.lua
@ -210,18 +210,20 @@ 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 l = {}
|
local first_cand
|
||||||
|
local index = 0
|
||||||
for cand in input:iter() do
|
for cand in input:iter() do
|
||||||
table.insert(l, cand)
|
index = index + 1
|
||||||
if #l >= env.idx then
|
if first_cand then
|
||||||
|
yield(cand)
|
||||||
|
else
|
||||||
|
first_cand = cand
|
||||||
|
end
|
||||||
|
if index >= env.idx then
|
||||||
|
yield(first_cand)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- 先 yield 汉字,再把英文放到后面
|
|
||||||
for i = 2, #l do
|
|
||||||
yield(l[i])
|
|
||||||
end
|
|
||||||
yield(l[1])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- yield other
|
-- yield other
|
||||||
|
Loading…
x
Reference in New Issue
Block a user