add lib-nested-tty::DisplaySegment trait for Node

This commit is contained in:
Michael Sippel 2023-11-28 17:16:23 +01:00
parent f3ad5c78d7
commit 9b9ea77cb0
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -31,24 +31,26 @@ pub trait TerminalView = GridView<Item = TerminalAtom>;
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
pub enum TerminalEditorResult {
Continue,
Exit,
}
pub trait TerminalEditor {
fn get_term_view(&self) -> OuterViewPort<dyn TerminalView>;
fn handle_terminal_event(&mut self, event: &TerminalEvent) -> TerminalEditorResult;
}
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
use r3vi::view::OuterViewPort; use r3vi::view::OuterViewPort;
pub trait DisplaySegment { pub trait DisplaySegment {
fn display_view(&self) -> OuterViewPort<dyn TerminalView>; fn display_view(&self) -> OuterViewPort<dyn TerminalView>;
} }
use nested::reprTree::Context;
use std::sync::{Arc, RwLock};
impl DisplaySegment for nested::editTree::NestedNode {
fn display_view(&self) -> OuterViewPort<dyn TerminalView> {
self.view.as_ref().unwrap()
.read().unwrap()
.descend( Context::parse(&self.ctx, "TerminalView") ).expect("terminal backend not supported by view")
.read().unwrap()
.get_port::<dyn TerminalView>().unwrap()
}
}
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
use { use {