diff options
Diffstat (limited to 'plugins/settings.lua')
-rw-r--r-- | plugins/settings.lua | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/plugins/settings.lua b/plugins/settings.lua index ec722bc..d6c524e 100644 --- a/plugins/settings.lua +++ b/plugins/settings.lua @@ -1624,11 +1624,13 @@ function Settings:load_keymap_settings() end table.sort(ordered) + ---@type widget.textbox + local textbox = TextBox(self.keybinds, "", "filter bindings...") + ---@type widget.listbox local listbox = ListBox(self.keybinds) listbox.border.width = 0 - listbox:enable_expand(true) listbox:add_column("Command") listbox:add_column("Bindings") @@ -1653,8 +1655,15 @@ function Settings:load_keymap_settings() }, name) end - function listbox:on_row_click(idx, data) - if not keymap_dialog:is_visible() then + function textbox:on_change(value) + listbox:filter(value) + end + + function listbox:on_mouse_pressed(button, x, y, clicks) + listbox.super.on_mouse_pressed(self, button, x, y, clicks) + local idx = listbox:get_selected() + local data = listbox:get_row_data(idx) + if clicks == 2 and not keymap_dialog:is_visible() then local bindings = { keymap.get_binding(data) } keymap_dialog:set_bindings(bindings) keymap_dialog.row_id = idx @@ -1663,6 +1672,14 @@ function Settings:load_keymap_settings() keymap_dialog:show() end end + + ---@param self widget + function self.keybinds:update_positions() + textbox:set_position(0, 0) + textbox:set_size(self:get_width() - self.border.width * 2) + listbox:set_position(0, textbox:get_bottom()) + listbox:set_size(self:get_width() - self.border.width * 2, self:get_height() - textbox:get_height()) + end end function Settings:setup_about() @@ -1819,6 +1836,10 @@ function Settings:update() end end + if self.keybinds:is_visible() then + self.keybinds:update_positions() + end + if self.about:is_visible() then self.about:update_positions() end |