@@ -47,10 +47,16 @@ local function get_default_tag_filter()
47
47
return ret
48
48
end
49
49
50
- tag_filter = tag_filter or get_default_tag_filter ()
50
+ _tag_filter = _tag_filter or nil
51
51
local selecting_filters = false
52
52
53
+ local function get_tag_filter ()
54
+ _tag_filter = _tag_filter or get_default_tag_filter ()
55
+ return _tag_filter
56
+ end
57
+
53
58
local function toggle_dev_mode ()
59
+ local tag_filter = get_tag_filter ()
54
60
tag_filter .excludes .dev = dev_mode or nil
55
61
tag_filter .excludes .unavailable = dev_mode or nil
56
62
if not dev_mode then
@@ -72,12 +78,14 @@ local function matches(a, b)
72
78
end
73
79
74
80
local function is_default_filter ()
81
+ local tag_filter = get_tag_filter ()
75
82
local default_filter = get_default_tag_filter ()
76
83
return matches (tag_filter .includes , default_filter .includes ) and
77
84
matches (tag_filter .excludes , default_filter .excludes )
78
85
end
79
86
80
87
local function get_filter_text ()
88
+ local tag_filter = get_tag_filter ()
81
89
if not next (tag_filter .includes ) and not next (tag_filter .excludes ) then
82
90
return ' Dev default'
83
91
elseif is_default_filter () then
258
266
function TagFilterPanel :on_submit ()
259
267
local _ ,choice = self .subviews .list :getSelected ()
260
268
if not choice then return end
269
+ local tag_filter = get_tag_filter ()
261
270
local tag = choice .tag
262
271
if tag_filter .includes [tag ] then
263
272
tag_filter .includes [tag ] = nil
275
284
function TagFilterPanel :toggle_all ()
276
285
local choices = self .subviews .list :getVisibleChoices ()
277
286
if not choices or # choices == 0 then return end
287
+ local tag_filter = get_tag_filter ()
278
288
local canonical_tag = choices [1 ].tag
279
289
if tag_filter .includes [canonical_tag ] then
280
290
for _ ,choice in ipairs (choices ) do
301
311
302
312
local function get_tag_text (tag )
303
313
local status , pen = ' ' , nil
314
+ local tag_filter = get_tag_filter ()
304
315
if tag_filter .includes [tag ] then
305
316
status , pen = ' (included)' , COLOR_GREEN
306
317
elseif tag_filter .excludes [tag ] then
@@ -372,7 +383,7 @@ function AutocompletePanel:init()
372
383
label = ' Reset tag filter' ,
373
384
disabled = is_default_filter ,
374
385
on_activate = function ()
375
- tag_filter = get_default_tag_filter ()
386
+ _tag_filter = get_default_tag_filter ()
376
387
if selecting_filters then
377
388
self .tag_filter_panel :refresh ()
378
389
end
@@ -958,8 +969,10 @@ function LauncherUI:update_autocomplete(firstword)
958
969
table.insert (ensure_key (excludes , ' tag' ), tag )
959
970
end
960
971
else
972
+ includes = {includes }
973
+ local tag_filter = get_tag_filter ()
961
974
for tag in pairs (tag_filter .includes ) do
962
- table.insert (ensure_key ( includes , ' tag' ), tag )
975
+ table.insert (includes , { tag = tag } )
963
976
end
964
977
for tag in pairs (tag_filter .excludes ) do
965
978
table.insert (ensure_key (excludes , ' tag' ), tag )
0 commit comments