File tree Expand file tree Collapse file tree 4 files changed +42
-3
lines changed
Expand file tree Collapse file tree 4 files changed +42
-3
lines changed Original file line number Diff line number Diff line change @@ -18,4 +18,21 @@ local function detect_os()
1818 return sys
1919end
2020
21- return { detect_os = detect_os }
21+ local function status (context )
22+ local stat = {}
23+ local composition = context .composition
24+ stat .always = true
25+ stat .composing = context :is_composing ()
26+ stat .empty = not stat .composing
27+ stat .has_menu = context :has_menu ()
28+ stat .paging = not composition .empty () and composition :back ():has_tag (" paging" )
29+ return stat
30+ end
31+
32+ return {
33+ detect_os = detect_os ,
34+ status = status ,
35+ kRejected = 0 ,
36+ kAccepted = 1 ,
37+ kNoop = 2
38+ }
Original file line number Diff line number Diff line change 1+ local function filter (input )
2+ local candidates = {}
3+ local del_text = {}
4+ local index_text = {}
5+ for cand in input :iter () do
6+ table.insert (index_text , cand .text )
7+ candidates [cand .text ] = cand
8+ if cand :get_genuine ().comment == " [删]" then
9+ table.insert (del_text , cand .text )
10+ end
11+ end
12+ for i , t in pairs (del_text ) do
13+ candidates [t ] = nil
14+ end
15+ for i , t in pairs (index_text ) do
16+ if candidates [t ] ~= nil then
17+ yield (candidates [t ])
18+ end
19+ end
20+ end
21+
22+ return filter
Original file line number Diff line number Diff line change @@ -22,15 +22,14 @@ local command = {
2222local function processor (key , env )
2323 local engine = env .engine
2424 local context = engine .context
25- local kNoop = 2
2625
2726 local sys = common .detect_os ()
2827 local cmd = command [sys ][context .input ]
2928 if cmd ~= nil then
3029 os.execute (cmd )
3130 context :clear ()
3231 end
33- return kNoop
32+ return common . kNoop
3433end
3534
3635return processor
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ engine:
5151 - history_translator@history
5252 filters :
5353 - lua_filter@openfly_hint_filter
54+ - lua_filter@openfly_deletion_filter
5455 - simplifier
5556 - simplifier@simplification
5657 - uniquifier
You can’t perform that action at this time.
0 commit comments