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![], 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 { impl Default for TreeCursor {

View file

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

View file

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

View file

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