From 9b9ea77cb041a64ef9064b5062aeb673b3802649 Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Tue, 28 Nov 2023 17:16:23 +0100 Subject: [PATCH] add lib-nested-tty::DisplaySegment trait for Node --- lib-nested-tty/src/lib.rs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lib-nested-tty/src/lib.rs b/lib-nested-tty/src/lib.rs index 21e89e4..85ded4d 100644 --- a/lib-nested-tty/src/lib.rs +++ b/lib-nested-tty/src/lib.rs @@ -31,24 +31,26 @@ pub trait TerminalView = GridView; //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> -pub enum TerminalEditorResult { - Continue, - Exit, -} - -pub trait TerminalEditor { - fn get_term_view(&self) -> OuterViewPort; - fn handle_terminal_event(&mut self, event: &TerminalEvent) -> TerminalEditorResult; -} - -//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> - use r3vi::view::OuterViewPort; pub trait DisplaySegment { fn display_view(&self) -> OuterViewPort; } + +use nested::reprTree::Context; +use std::sync::{Arc, RwLock}; + +impl DisplaySegment for nested::editTree::NestedNode { + fn display_view(&self) -> OuterViewPort { + self.view.as_ref().unwrap() + .read().unwrap() + .descend( Context::parse(&self.ctx, "TerminalView") ).expect("terminal backend not supported by view") + .read().unwrap() + .get_port::().unwrap() + } +} + //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> use {