summaryrefslogtreecommitdiff
path: root/helix-view/src/macros.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view/src/macros.rs')
-rw-r--r--helix-view/src/macros.rs29
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)
+ }};
+}