mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 10:31:50 +00:00
Merge pull request #956 from Neveix/feat-pack-filter-by-id
Feature: pack filter by id
This commit is contained in:
commit
eb3cf86e6c
2 changed files with 6 additions and 5 deletions
|
|
@ -67,16 +67,16 @@ function refresh_search()
|
|||
local new_included = table.copy(packs_included)
|
||||
local new_excluded = table.copy(packs_excluded)
|
||||
|
||||
local function score(pack_name)
|
||||
if pack_name:lower():find(search_text) then
|
||||
local function score(pack_id, pack_name)
|
||||
if pack_name:lower():find(search_text) or pack_id:lower():find(search_text) then
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
local function sorting(a, b)
|
||||
local score_a = score(packs_info[a][2])
|
||||
local score_b = score(packs_info[b][2])
|
||||
local score_a = score(a, packs_info[a][2])
|
||||
local score_b = score(b, packs_info[b][2])
|
||||
|
||||
if score_a ~= score_b then
|
||||
return score_a > score_b
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ local CONFIG_NAMES = {
|
|||
|
||||
function on_open()
|
||||
refresh()
|
||||
document.search_textbox.focused = true
|
||||
end
|
||||
|
||||
function place_pack(panel, packinfo, callback)
|
||||
|
|
@ -39,7 +40,7 @@ function refresh_search()
|
|||
local pos = content.pos
|
||||
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.pos = {pos[1], visible * (size[2] + interval) - step}
|
||||
visible = visible + 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue