2021-08-23 05:00:57 +02:00
|
|
|
use crate::list::ListCursorMode;
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, Eq, PartialEq)]
|
2021-08-15 04:27:09 +02:00
|
|
|
pub enum TreeNavResult {
|
|
|
|
Continue,
|
2021-11-19 12:19:52 +01:00
|
|
|
Exit,
|
2021-08-15 04:27:09 +02:00
|
|
|
}
|
2021-08-26 08:20:51 +02:00
|
|
|
/*
|
|
|
|
impl From<TreeNavResult> for TerminalEditorResult {
|
|
|
|
fn from(v: TreeNavResult) -> TerminalEditorResult {
|
|
|
|
match v {
|
|
|
|
TreeNavResult::Continue => TerminalEditorResult::Continue,
|
|
|
|
TreeNavResult::Exit => TerminalEditorResult::Exit
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
2021-08-23 05:00:57 +02:00
|
|
|
#[derive(Clone, Eq, PartialEq)]
|
|
|
|
pub struct TreeCursor {
|
|
|
|
pub leaf_mode: ListCursorMode,
|
2021-11-19 12:19:52 +01:00
|
|
|
pub tree_addr: Vec<usize>,
|
2021-08-23 05:00:57 +02:00
|
|
|
}
|
|
|
|
|
2021-08-26 08:20:51 +02:00
|
|
|
impl Default for TreeCursor {
|
|
|
|
fn default() -> Self {
|
|
|
|
TreeCursor {
|
|
|
|
leaf_mode: ListCursorMode::Select,
|
2021-11-19 12:19:52 +01:00
|
|
|
tree_addr: vec![],
|
2021-08-26 08:20:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-15 04:27:09 +02:00
|
|
|
pub trait TreeNav {
|
|
|
|
fn up(&mut self) -> TreeNavResult {
|
|
|
|
TreeNavResult::Exit
|
|
|
|
}
|
|
|
|
|
|
|
|
fn dn(&mut self) -> TreeNavResult {
|
|
|
|
TreeNavResult::Exit
|
|
|
|
}
|
|
|
|
|
|
|
|
fn pxev(&mut self) -> TreeNavResult {
|
|
|
|
TreeNavResult::Exit
|
|
|
|
}
|
|
|
|
|
|
|
|
fn nexd(&mut self) -> TreeNavResult {
|
|
|
|
TreeNavResult::Exit
|
|
|
|
}
|
|
|
|
|
|
|
|
fn goto_home(&mut self) -> TreeNavResult {
|
2021-11-19 12:19:52 +01:00
|
|
|
TreeNavResult::Exit
|
2021-08-15 04:27:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fn goto_end(&mut self) -> TreeNavResult {
|
2021-11-19 12:19:52 +01:00
|
|
|
TreeNavResult::Exit
|
2021-08-15 04:27:09 +02:00
|
|
|
}
|
2021-08-16 00:10:25 +02:00
|
|
|
|
2021-11-19 12:19:52 +01:00
|
|
|
fn goto(&mut self, _new_cursor: TreeCursor) -> TreeNavResult {
|
2021-08-15 04:27:09 +02:00
|
|
|
TreeNavResult::Exit
|
|
|
|
}
|
2021-08-16 00:10:25 +02:00
|
|
|
|
2021-08-26 08:20:51 +02:00
|
|
|
fn get_cursor(&self) -> TreeCursor {
|
|
|
|
TreeCursor::default()
|
2021-08-16 00:10:25 +02:00
|
|
|
}
|
2021-08-15 04:27:09 +02:00
|
|
|
}
|
|
|
|
|
2021-11-19 12:19:52 +01:00
|
|
|
use crate::terminal::{TerminalEditor};
|
2021-08-15 04:27:09 +02:00
|
|
|
|
|
|
|
pub trait TerminalTreeEditor = TerminalEditor + TreeNav;
|