chore: allow macro to destructure

pull/12902/head
Nikita Revenco 2025-02-17 22:24:13 +00:00
parent 43f40d318f
commit 7dc631de9a
2 changed files with 2 additions and 2 deletions

View File

@ -333,7 +333,7 @@ pub fn file_explorer(root: PathBuf, editor: &Editor) -> Result<FileExplorer, std
.with_key_handlers(declare_key_handlers! {
// TODO: add a way to get user input in the Picker component and then
// execute an action based on that. Maybe re-use the existing Prompt component somehow?
|cx, path: &(PathBuf, bool)|,
|cx, (path, _is_dir): &(PathBuf, bool)|,
// create
alt!('c') => {
// TODO: ask user for name of file to be created

View File

@ -1186,7 +1186,7 @@ pub type PickerKeyHandler<T> = HashMap<KeyEvent, Box<dyn Fn(&mut Context, &T) +
/// Convenience macro to add custom keybindings per picker
#[macro_export]
macro_rules! declare_key_handlers {
(|$cx:ident, $item:ident : $t:ty|, $($key:expr => $handler:block),* $(,)?) => {
(|$cx:ident, $item:tt : $t:ty|, $($key:expr => $handler:block),* $(,)?) => {
hashmap!(
$(
$key => Box::new(|$cx: &mut Context, $item: $t| $handler)