diff options
author | Jan Hrastnik | 2021-06-19 12:51:53 +0000 |
---|---|---|
committer | Jan Hrastnik | 2021-06-19 12:51:53 +0000 |
commit | cdd9347457f0608346894cd0aab35b412cb59a7b (patch) | |
tree | 468078c37311cb1c7f9e7d4bd8a03c493d25e669 /helix-view/src/macros.rs | |
parent | 97323dc2f90f81afc82bd929d111abda540bebe5 (diff) | |
parent | 2cbec2b0470d0759578929b224c445b69617b6b6 (diff) |
Merge remote-tracking branch 'origin/master' into line_ending_detection
Diffstat (limited to 'helix-view/src/macros.rs')
-rw-r--r-- | helix-view/src/macros.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/helix-view/src/macros.rs b/helix-view/src/macros.rs new file mode 100644 index 00000000..a06d37e7 --- /dev/null +++ b/helix-view/src/macros.rs @@ -0,0 +1,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) + }}; +} |