add get_subcursor()

This commit is contained in:
Michael Sippel 2023-11-11 18:00:47 +01:00
parent 10bff8a32c
commit 153faf9c13
Signed by: senvas
GPG key ID: F96CF119C34B64A6
4 changed files with 17 additions and 8 deletions

View file

@ -24,6 +24,17 @@ impl TreeCursor {
tree_addr: vec![],
}
}
pub fn get_subcursor(&self, depth: usize) -> TreeCursor {
TreeCursor {
leaf_mode: self.leaf_mode,
tree_addr: if depth < self.tree_addr.len() {
self.tree_addr[ depth.. ].iter().cloned().collect()
} else {
vec![]
}
}
}
}
impl Default for TreeCursor {

View file

@ -181,3 +181,4 @@ pub trait TreeNav {
}
}

View file

@ -32,18 +32,15 @@ struct NestedNodeEdit {
/// abstract editor
pub editor: SingletonBuffer<
Option< Arc<dyn Any + Send + Sync> >
>,
>,
pub input_buf:: VecBuffer< NestedNode >,
pub output_buf: VecBuffer< NestedNode >,
pub spillbuf: VecBuffer< NestedNode >,
/// commander & navigation
pub cmd: SingletonBuffer<
Option< Arc<RwLock<dyn ObjCommander + Send + Sync>> >
>,
pub close_char: SingletonBuffer<
Option< char >
>,
pub close_char: SingletonBuffer< Option< char > >,
// could be replaced by cmd when TreeNav -CmdObjects are used
pub tree_nav: SingletonBuffer<

View file

@ -7,8 +7,8 @@ use {
};
pub trait TreeType {
fn get_type(&self, _addr: &TreeAddr) -> TypeTerm {
TypeTerm::new(TypeID::Var(0))
fn get_type(&self, addr: &TreeAddr) -> Vec<TypeTerm> {
vec![]
}
}