From 153faf9c13b5faed44290b2488e62d36c81eaf48 Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Sat, 11 Nov 2023 18:00:47 +0100 Subject: [PATCH] add get_subcursor() --- nested/src/tree/cursor.rs | 11 +++++++++++ nested/src/tree/nav.rs | 1 + nested/src/tree/node.rs | 9 +++------ nested/src/tree/treetype.rs | 4 ++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/nested/src/tree/cursor.rs b/nested/src/tree/cursor.rs index 934be6d..9caa659 100644 --- a/nested/src/tree/cursor.rs +++ b/nested/src/tree/cursor.rs @@ -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 { diff --git a/nested/src/tree/nav.rs b/nested/src/tree/nav.rs index 488e26b..67acee3 100644 --- a/nested/src/tree/nav.rs +++ b/nested/src/tree/nav.rs @@ -181,3 +181,4 @@ pub trait TreeNav { } } + diff --git a/nested/src/tree/node.rs b/nested/src/tree/node.rs index c73da7c..75fdf3e 100644 --- a/nested/src/tree/node.rs +++ b/nested/src/tree/node.rs @@ -32,18 +32,15 @@ struct NestedNodeEdit { /// abstract editor pub editor: SingletonBuffer< Option< Arc > ->, + >, - pub input_buf:: VecBuffer< NestedNode >, - pub output_buf: VecBuffer< NestedNode >, + pub spillbuf: VecBuffer< NestedNode >, /// commander & navigation pub cmd: SingletonBuffer< Option< Arc> > >, - 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< diff --git a/nested/src/tree/treetype.rs b/nested/src/tree/treetype.rs index 9fd9ae3..07f0dce 100644 --- a/nested/src/tree/treetype.rs +++ b/nested/src/tree/treetype.rs @@ -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 { + vec![] } }