aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifest.json2
-rw-r--r--plugins/settings.lua27
2 files changed, 25 insertions, 4 deletions
diff --git a/manifest.json b/manifest.json
index d6be566..5359c8a 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1039,7 +1039,7 @@
},
{
"description": "Provides a GUI to manage core and plugin settings, bindings and select color theme *([video](https://user-images.githubusercontent.com/1702572/169743674-ececae24-f6b7-4ff2-bfa2-c4762cd327d9.mp4))*. (depends on [`widget`](https://github.com/lite-xl/lite-xl-widgets))",
- "version": "0.3",
+ "version": "0.4",
"path": "plugins/settings.lua",
"id": "settings",
"mod_version": "3"
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