Merge pull request #956 from Neveix/feat-pack-filter-by-id

Feature: pack filter by id
This commit is contained in:
MihailRis 2026-08-29 22:09:18 +03:00 • committed by GitHub
commit eb3cf86e6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View file

@ -67,16 +67,16 @@ function refresh_search()
local new_included = table.copy(packs_included) local new_included = table.copy(packs_included)
local new_excluded = table.copy(packs_excluded) local new_excluded = table.copy(packs_excluded)
local function score(pack_name) local function score(pack_id, pack_name)
if pack_name:lower():find(search_text) then if pack_name:lower():find(search_text) or pack_id:lower():find(search_text) then
return 1 return 1
end end
return 0 return 0
end end
local function sorting(a, b) local function sorting(a, b)
local score_a = score(packs_info[a][2]) local score_a = score(a, packs_info[a][2])
local score_b = score(packs_info[b][2]) local score_b = score(b, packs_info[b][2])
if score_a ~= score_b then if score_a ~= score_b then
return score_a > score_b return score_a > score_b

View file

@ -11,6 +11,7 @@ local CONFIG_NAMES = {
function on_open() function on_open()
refresh() refresh()
document.search_textbox.focused = true
end end
function place_pack(panel, packinfo, callback) function place_pack(panel, packinfo, callback)
@ -39,7 +40,7 @@ function refresh_search()
local pos = content.pos local pos = content.pos
local size = content.size local size = content.size
if title:lower():find(search_text) or search_text == '' then if title:lower():find(search_text) or id:lower():find(search_text) or search_text == '' then
content.enabled = true content.enabled = true
content.pos = {pos[1], visible * (size[2] + interval) - step} content.pos = {pos[1], visible * (size[2] + interval) - step}
visible = visible + 1 visible = visible + 1