FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
librime-lua-script/lua/component/word_filter.lua at main · shewer/librime-lua-script · GitHub
shewer
librime-lua-script
Repository navigation
Code
Issues
4
(4)
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
librime-lua-script
/
lua
/
component
/
word_filter.lua
Copy path
More file actions
More file actions
Latest commit
History
History
History
45 lines (41 loc) · 896 Bytes
Breadcrumbs
librime-lua-script
/
lua
/
component
/
word_filter.lua
Copy path
File metadata and controls
45 lines (41 loc) · 896 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--
<user_data_dir>/lua/word.lua
local
M
=
{}
function
M
.
init
(
env
)
local
config
=
env
.
engine
.
schema
.
config
--
default translator
env
.
finals
=
config
:
get_string
(
"
speller/finals
"
)
end
function
M
.
fini
(
env
)
end
--
enable func
local
function
func
(
input
,
env
)
local
context
=
env
.
engine
.
context
local
tab
=
{}
for
cand
in
input
:
iter
()
do
local
completion
=
cand
.
type
==
"
completion
"
if
not
completion
and
utf8.len
(
cand
.
text
)
>
1
then
yield
(
cand
)
else
table.insert
(
tab
,
cand
)
if
completion
then
break
end
end
end
for
_
,
cand
in
next
,
tab
do
yield
(
cand
)
end
for
cand
in
input
:
iter
()
do
yield
(
cand
)
end
end
function
M
.
func
(
input
,
env
)
local
context
=
env
.
engine
.
context
if
context
.
input
:
sub
(
-
1
)
~=
env
.
finals
then
--
bypass translation
for
cand
in
input
:
iter
()
do
yield
(
cand
)
end
else
func
(
input
,
env
)
end
end
return
M
Back
|
FazBrowse Home
|
New Git URL