Skip to content

Commit c8fdddc

Browse files
committed
fix initial incorrect armok filter setting and make tag match all
1 parent 7232ad5 commit c8fdddc

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

gui/launcher.lua

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,16 @@ local function get_default_tag_filter()
4747
return ret
4848
end
4949

50-
tag_filter = tag_filter or get_default_tag_filter()
50+
_tag_filter = _tag_filter or nil
5151
local selecting_filters = false
5252

53+
local function get_tag_filter()
54+
_tag_filter = _tag_filter or get_default_tag_filter()
55+
return _tag_filter
56+
end
57+
5358
local function toggle_dev_mode()
59+
local tag_filter = get_tag_filter()
5460
tag_filter.excludes.dev = dev_mode or nil
5561
tag_filter.excludes.unavailable = dev_mode or nil
5662
if not dev_mode then
@@ -72,12 +78,14 @@ local function matches(a, b)
7278
end
7379

7480
local function is_default_filter()
81+
local tag_filter = get_tag_filter()
7582
local default_filter = get_default_tag_filter()
7683
return matches(tag_filter.includes, default_filter.includes) and
7784
matches(tag_filter.excludes, default_filter.excludes)
7885
end
7986

8087
local function get_filter_text()
88+
local tag_filter = get_tag_filter()
8189
if not next(tag_filter.includes) and not next(tag_filter.excludes) then
8290
return 'Dev default'
8391
elseif is_default_filter() then
@@ -258,6 +266,7 @@ end
258266
function TagFilterPanel:on_submit()
259267
local _,choice = self.subviews.list:getSelected()
260268
if not choice then return end
269+
local tag_filter = get_tag_filter()
261270
local tag = choice.tag
262271
if tag_filter.includes[tag] then
263272
tag_filter.includes[tag] = nil
@@ -275,6 +284,7 @@ end
275284
function TagFilterPanel:toggle_all()
276285
local choices = self.subviews.list:getVisibleChoices()
277286
if not choices or #choices == 0 then return end
287+
local tag_filter = get_tag_filter()
278288
local canonical_tag = choices[1].tag
279289
if tag_filter.includes[canonical_tag] then
280290
for _,choice in ipairs(choices) do
@@ -301,6 +311,7 @@ end
301311

302312
local function get_tag_text(tag)
303313
local status, pen = '', nil
314+
local tag_filter = get_tag_filter()
304315
if tag_filter.includes[tag] then
305316
status, pen = '(included)', COLOR_GREEN
306317
elseif tag_filter.excludes[tag] then
@@ -372,7 +383,7 @@ function AutocompletePanel:init()
372383
label='Reset tag filter',
373384
disabled=is_default_filter,
374385
on_activate=function()
375-
tag_filter = get_default_tag_filter()
386+
_tag_filter = get_default_tag_filter()
376387
if selecting_filters then
377388
self.tag_filter_panel:refresh()
378389
end
@@ -958,8 +969,10 @@ function LauncherUI:update_autocomplete(firstword)
958969
table.insert(ensure_key(excludes, 'tag'), tag)
959970
end
960971
else
972+
includes = {includes}
973+
local tag_filter = get_tag_filter()
961974
for tag in pairs(tag_filter.includes) do
962-
table.insert(ensure_key(includes, 'tag'), tag)
975+
table.insert(includes, {tag=tag})
963976
end
964977
for tag in pairs(tag_filter.excludes) do
965978
table.insert(ensure_key(excludes, 'tag'), tag)

0 commit comments

Comments
 (0)