Skip to content

Commit

Permalink
Merge pull request #1028 from myk002/myk_control_panel_list
Browse files Browse the repository at this point in the history
[control-panel] fix list command filtering
  • Loading branch information
myk002 authored Mar 8, 2024
2 parents d0148fb + 942e9f0 commit fe55eb4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Template for new versions:

## Fixes
- `gui/launcher`: fix history scanning (Up/Down arrow keys) being slow to respond when in minimal mode
- `control-panel`: fix filtering not filtering when running the ``list`` command

## Misc Improvements
- `gui/launcher`: add interface for browsing and filtering commands by tags
Expand Down
5 changes: 2 additions & 3 deletions control-panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ end
local function list_command_group(group, filter_strs, enabled_map)
local header = ('Group: %s'):format(group)
for idx, data in ipairs(registry.COMMANDS_BY_IDX) do
local first_word = common.get_first_word(data.command)
if not common.command_passes_filters(data, group, first_word, filter_strs) then
if not common.command_passes_filters(data, group, filter_strs) then
goto continue
end
if header then
Expand Down Expand Up @@ -142,7 +141,7 @@ local function list_preferences(filter_strs)
end

local function do_list(filter_strs)
local enabled_map =common.get_enabled_map()
local enabled_map = common.get_enabled_map()
list_command_group('automation', filter_strs, enabled_map)
list_command_group('bugfix', filter_strs, enabled_map)
list_command_group('gameplay', filter_strs, enabled_map)
Expand Down
7 changes: 3 additions & 4 deletions internal/control-panel/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,9 @@ function command_passes_filters(data, target_group, filter_strs)
then
return false
end
if not utils.search_text(data.command, filter_strs) then
return false
end
return true
return data.help_command and
utils.search_text(data.help_command, filter_strs) or
utils.search_text(data.command, filter_strs)
end

function get_description(data)
Expand Down

0 comments on commit fe55eb4

Please sign in to comment.