aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/macros.rs
diff options
context:
space:
mode:
authorJan Hrastnik2021-06-19 12:51:53 +0000
committerJan Hrastnik2021-06-19 12:51:53 +0000
commitcdd9347457f0608346894cd0aab35b412cb59a7b (patch)
tree468078c37311cb1c7f9e7d4bd8a03c493d25e669 /helix-view/src/macros.rs
parent97323dc2f90f81afc82bd929d111abda540bebe5 (diff)
parent2cbec2b0470d0759578929b224c445b69617b6b6 (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.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)
+ }};
+}