|
|
@ -11,10 +11,19 @@
|
|
|
|
/// Returns `(&mut View, &mut Document)`
|
|
|
|
/// Returns `(&mut View, &mut Document)`
|
|
|
|
#[macro_export]
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! current {
|
|
|
|
macro_rules! current {
|
|
|
|
( $( $editor:ident ).+ ) => {{
|
|
|
|
($editor:expr) => {{
|
|
|
|
let view = $crate::view_mut!( $( $editor ).+ );
|
|
|
|
let view = $crate::view_mut!($editor);
|
|
|
|
let id = view.doc;
|
|
|
|
let id = view.doc;
|
|
|
|
let doc = $( $editor ).+ .documents.get_mut(&id).unwrap();
|
|
|
|
let doc = $editor.documents.get_mut(&id).unwrap();
|
|
|
|
|
|
|
|
(view, doc)
|
|
|
|
|
|
|
|
}};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
|
|
|
|
macro_rules! current_ref {
|
|
|
|
|
|
|
|
($editor:expr) => {{
|
|
|
|
|
|
|
|
let view = $editor.tree.get($editor.tree.focus);
|
|
|
|
|
|
|
|
let doc = &$editor.documents[&view.doc];
|
|
|
|
(view, doc)
|
|
|
|
(view, doc)
|
|
|
|
}};
|
|
|
|
}};
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -23,8 +32,8 @@ macro_rules! current {
|
|
|
|
/// Returns `&mut Document`
|
|
|
|
/// Returns `&mut Document`
|
|
|
|
#[macro_export]
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! doc_mut {
|
|
|
|
macro_rules! doc_mut {
|
|
|
|
( $( $editor:ident ).+ ) => {{
|
|
|
|
($editor:expr) => {{
|
|
|
|
$crate::current!( $( $editor ).+ ).1
|
|
|
|
$crate::current!($editor).1
|
|
|
|
}};
|
|
|
|
}};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -32,8 +41,8 @@ macro_rules! doc_mut {
|
|
|
|
/// Returns `&mut View`
|
|
|
|
/// Returns `&mut View`
|
|
|
|
#[macro_export]
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! view_mut {
|
|
|
|
macro_rules! view_mut {
|
|
|
|
( $( $editor:ident ).+ ) => {{
|
|
|
|
($editor:expr) => {{
|
|
|
|
$( $editor ).+ .tree.get_mut($( $editor ).+ .tree.focus)
|
|
|
|
$editor.tree.get_mut($editor.tree.focus)
|
|
|
|
}};
|
|
|
|
}};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -41,23 +50,14 @@ macro_rules! view_mut {
|
|
|
|
/// Returns `&View`
|
|
|
|
/// Returns `&View`
|
|
|
|
#[macro_export]
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! view {
|
|
|
|
macro_rules! view {
|
|
|
|
( $( $editor:ident ).+ ) => {{
|
|
|
|
($editor:expr) => {{
|
|
|
|
$( $editor ).+ .tree.get($( $editor ).+ .tree.focus)
|
|
|
|
$editor.tree.get($editor.tree.focus)
|
|
|
|
}};
|
|
|
|
}};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! doc {
|
|
|
|
macro_rules! doc {
|
|
|
|
( $( $editor:ident ).+ ) => {{
|
|
|
|
($editor:expr) => {{
|
|
|
|
$crate::current_ref!( $( $editor ).+ ).1
|
|
|
|
$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)
|
|
|
|
|
|
|
|
}};
|
|
|
|
}};
|
|
|
|
}
|
|
|
|
}
|
|
|
|