summaryrefslogtreecommitdiff
path: root/helix-view/src/macros.rs
blob: a06d37e78201c324e50f8380930b1428a81c4b4b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#[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)
    }};
}