diff options
author | Blaž Hrastnik | 2021-10-17 04:51:56 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-10-17 04:51:56 +0000 |
commit | 0a6b60085a56876068bf652c9491c435e9cca229 (patch) | |
tree | 8681db55d1a7707421f98d81a108d6438459536a /helix-view/src/macros.rs | |
parent | bc0084d071ac53fa460370667cdd8740e7499c76 (diff) | |
parent | e216e9621e73cda1968632cd20595231af5e07be (diff) |
Merge branch 'master' into debug
Diffstat (limited to 'helix-view/src/macros.rs')
-rw-r--r-- | helix-view/src/macros.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/helix-view/src/macros.rs b/helix-view/src/macros.rs index c9a04270..0bebd02f 100644 --- a/helix-view/src/macros.rs +++ b/helix-view/src/macros.rs @@ -44,3 +44,19 @@ macro_rules! view { $( $editor ).+ .tree.get($( $editor ).+ .tree.focus) }}; } + +#[macro_export] +macro_rules! doc { + ( $( $editor:ident ).+ ) => {{ + $crate::current_ref!( $( $editor ).+ ).1 + }}; +} + +#[macro_export] +macro_rules! current_ref { + ( $( $editor:ident ).+ ) => {{ + let view = $( $editor ).+ .tree.get($( $editor ).+ .tree.focus); + let doc = &$( $editor ).+ .documents[view.doc]; + (view, doc) + }}; +} |