You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
helix-plus/helix-view/src/macros.rs

30 lines
644 B
Rust

#[macro_export]
macro_rules! current {
( $( $editor:ident ).+ ) => {{
let view = $crate::view_mut!( $( $editor ).+ );
let doc = &mut $( $editor ).+ .documents[view.doc];
(view, doc)
}};
}
#[macro_export]
macro_rules! doc_mut {
( $( $editor:ident ).+ ) => {{
$crate::current!( $( $editor ).+ ).1
}};
}
#[macro_export]
macro_rules! view_mut {
( $( $editor:ident ).+ ) => {{
$( $editor ).+ .tree.get_mut($( $editor ).+ .tree.focus)
}};
}
#[macro_export]
macro_rules! view {
( $( $editor:ident ).+ ) => {{
$( $editor ).+ .tree.get($( $editor ).+ .tree.focus)
}};
}