add lib-nested-tty::DisplaySegment trait for Node
This commit is contained in:
parent
f3ad5c78d7
commit
9b9ea77cb0
1 changed files with 14 additions and 12 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue