mirror of https://github.com/helix-editor/helix
chore: allow macro to destructure
parent
43f40d318f
commit
7dc631de9a
|
@ -333,7 +333,7 @@ pub fn file_explorer(root: PathBuf, editor: &Editor) -> Result<FileExplorer, std
|
||||||
.with_key_handlers(declare_key_handlers! {
|
.with_key_handlers(declare_key_handlers! {
|
||||||
// TODO: add a way to get user input in the Picker component and then
|
// 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?
|
// 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
|
// create
|
||||||
alt!('c') => {
|
alt!('c') => {
|
||||||
// TODO: ask user for name of file to be created
|
// TODO: ask user for name of file to be created
|
||||||
|
|
|
@ -1186,7 +1186,7 @@ pub type PickerKeyHandler<T> = HashMap<KeyEvent, Box<dyn Fn(&mut Context, &T) +
|
||||||
/// Convenience macro to add custom keybindings per picker
|
/// Convenience macro to add custom keybindings per picker
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! declare_key_handlers {
|
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!(
|
hashmap!(
|
||||||
$(
|
$(
|
||||||
$key => Box::new(|$cx: &mut Context, $item: $t| $handler)
|
$key => Box::new(|$cx: &mut Context, $item: $t| $handler)
|
||||||
|
|
Loading…
Reference in New Issue