feat: add support for setting the initial query value in palettes
This commit is contained in:
parent
42b7ae46a0
commit
74b011cf7e
1 changed files with 6 additions and 0 deletions
|
@ -91,6 +91,12 @@ pub fn Create(options: type) type {
|
|||
if (@hasDecl(options, "restore_state"))
|
||||
options.restore_state(self) catch {};
|
||||
try self.commands.init(self);
|
||||
if (@hasDecl(options, "initial_query")) blk: {
|
||||
const initial_query = options.initial_query(self, self.allocator) catch break :blk;
|
||||
defer self.allocator.free(initial_query);
|
||||
try self.inputbox.text.appendSlice(self.allocator, initial_query);
|
||||
self.inputbox.cursor = tui.egc_chunk_width(self.inputbox.text.items, 0, 8);
|
||||
}
|
||||
try self.start_query(0);
|
||||
try mv.floating_views.add(self.modal.widget());
|
||||
try mv.floating_views.add(self.menu.container_widget);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue