From b2f437d7df4ea15054c8587aa72fbe764bec3d5c Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Sun, 23 Oct 2022 19:29:50 +0200 Subject: [PATCH] add diagnostics; contanis some bugs --- nested/src/char_editor.rs | 3 ++ nested/src/color.rs | 2 +- nested/src/diagnostics.rs | 91 ++++++++++++++++++++++++++++++++++ nested/src/integer/editor.rs | 58 +++++++++++++++++++--- nested/src/lib.rs | 3 +- nested/src/list/pty_editor.rs | 25 ++++++++++ nested/src/product/editor.rs | 65 ++++++++++++++++++++---- nested/src/sequence/flatten.rs | 11 ++-- nested/src/tree_nav.rs | 3 +- shell/src/command.rs | 43 ++++++++++++++-- shell/src/main.rs | 71 +++++++++++++++++++------- shell/src/process.rs | 8 +++ 12 files changed, 340 insertions(+), 43 deletions(-) create mode 100644 nested/src/diagnostics.rs diff --git a/nested/src/char_editor.rs b/nested/src/char_editor.rs index ce7b222..2591b44 100644 --- a/nested/src/char_editor.rs +++ b/nested/src/char_editor.rs @@ -9,6 +9,7 @@ use { TerminalView, }, tree_nav::{TerminalTreeEditor, TreeCursor, TreeNav, TreeNavResult}, + diagnostics::Diagnostics }, std::sync::Arc, std::sync::RwLock, @@ -37,6 +38,8 @@ impl CharEditor { } impl TreeNav for CharEditor {} +impl Diagnostics for CharEditor {} + impl TerminalEditor for CharEditor { fn get_term_view(&self) -> OuterViewPort { self.data diff --git a/nested/src/color.rs b/nested/src/color.rs index 9f5ae9e..5e94396 100644 --- a/nested/src/color.rs +++ b/nested/src/color.rs @@ -6,7 +6,7 @@ pub fn bg_style_from_depth(depth: usize) -> TerminalStyle { match depth { 0 => TerminalStyle::bg_color((150,80,230)), 1 => TerminalStyle::bg_color((35,35,35)), - 2 => TerminalStyle::bg_color((10,10,10)), + 2 => TerminalStyle::bg_color((20,20,20)), _ => TerminalStyle::default(), } } diff --git a/nested/src/diagnostics.rs b/nested/src/diagnostics.rs new file mode 100644 index 0000000..c5e8b8a --- /dev/null +++ b/nested/src/diagnostics.rs @@ -0,0 +1,91 @@ +use { + crate::{ + core::{OuterViewPort, ViewPort}, + sequence::{SequenceView, SequenceViewExt, decorator::{PTYSeqDecorate, SeqDecorStyle}}, + vec::{VecBuffer}, + index::{buffer::IndexBuffer}, + terminal::{ + TerminalView, TerminalStyle, make_label + } + }, + cgmath::Point2 +}; + +#[derive(Clone)] +pub struct Message { + pub addr: Vec, + pub port: OuterViewPort +} + +pub trait Diagnostics { + fn get_msg_port(&self) -> OuterViewPort> { + VecBuffer::new().get_port().to_sequence() + } +} + +pub fn make_error(msg: OuterViewPort) -> Message { + let mut mb = IndexBuffer::new(); + mb.insert_iter(vec![ + (Point2::new(0, 0), + make_label("error: ") + .map_item(|p,a| a + .add_style_back(TerminalStyle::bold(true)) + .add_style_back(TerminalStyle::fg_color((200,0,0)))) + ), + (Point2::new(1, 0), + msg + .map_item(|p,a| a + .add_style_back(TerminalStyle::fg_color((180,180,180)))) + ) + ]); + + Message { + addr: vec![], + port: mb.get_port().flatten() + } +} + +pub fn make_warn(msg: OuterViewPort) -> Message { + let mut mb = IndexBuffer::new(); + mb.insert_iter(vec![ + (Point2::new(0, 0), + make_label("warning: ") + .map_item(|p,a| a + .add_style_back(TerminalStyle::bold(true)) + .add_style_back(TerminalStyle::fg_color((200,200,0)))) + ), + (Point2::new(1, 0), + msg + .map_item(|p,a| a + .add_style_back(TerminalStyle::fg_color((180,180,180)))) + ) + ]); + + Message { + addr: vec![], + port: mb.get_port().flatten() + } +} + +pub fn make_todo(msg: OuterViewPort) -> Message { + let mut mb = IndexBuffer::new(); + mb.insert_iter(vec![ + (Point2::new(0, 0), + make_label("todo: ") + .map_item(|p,a| a + .add_style_back(TerminalStyle::bold(true)) + .add_style_back(TerminalStyle::fg_color((180,180,250)))) + ), + (Point2::new(1, 0), + msg + .map_item(|p,a| a + .add_style_back(TerminalStyle::fg_color((180,180,180)))) + ) + ]); + + Message { + addr: vec![], + port: mb.get_port().flatten() + } +} + diff --git a/nested/src/integer/editor.rs b/nested/src/integer/editor.rs index fe5d194..21afafa 100644 --- a/nested/src/integer/editor.rs +++ b/nested/src/integer/editor.rs @@ -4,23 +4,27 @@ use { list::{PTYListEditor}, sequence::{SequenceView, SequenceViewExt, decorator::{PTYSeqDecorate, SeqDecorStyle}}, singleton::{SingletonBuffer, SingletonView}, + vec::{VecBuffer}, + index::{buffer::IndexBuffer}, terminal::{ TerminalAtom, TerminalEditor, TerminalEditorResult, TerminalEvent, TerminalStyle, - TerminalView, + TerminalView, make_label }, tree_nav::{TerminalTreeEditor, TreeCursor, TreeNav, TreeNavResult}, + diagnostics::{Diagnostics, Message} }, std::sync::Arc, std::sync::RwLock, termion::event::{Event, Key}, - cgmath::Vector2 + cgmath::{Vector2, Point2} }; //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> pub struct DigitEditor { radix: u32, - data: SingletonBuffer> + data: SingletonBuffer>, + msg: VecBuffer, } impl DigitEditor { @@ -28,6 +32,7 @@ impl DigitEditor { DigitEditor { radix, data: SingletonBuffer::new(None), + msg: VecBuffer::new(), } } @@ -63,11 +68,26 @@ impl TerminalEditor for DigitEditor { | TerminalEvent::Input(Event::Key(Key::Char('\n'))) => TerminalEditorResult::Exit, TerminalEvent::Input(Event::Key(Key::Char(c))) => { self.data.set(Some(*c)); + + self.msg.clear(); + if c.to_digit(self.radix).is_none() { + let mut mb = IndexBuffer::new(); + mb.insert_iter(vec![ + (Point2::new(1, 0), make_label("invalid digit '")), + (Point2::new(2, 0), make_label(&format!("{}", *c)) + .map_item(|p,a| a.add_style_back(TerminalStyle::fg_color((140,140,250))))), + (Point2::new(3, 0), make_label("'")) + ]); + self.msg.push(crate::diagnostics::make_error(mb.get_port().flatten())); + } + TerminalEditorResult::Exit } TerminalEvent::Input(Event::Key(Key::Backspace)) | TerminalEvent::Input(Event::Key(Key::Delete)) => { self.data.set(None); + self.msg.clear(); + self.msg.push(crate::diagnostics::make_warn(make_label("empty digit"))); TerminalEditorResult::Exit } _ => TerminalEditorResult::Continue, @@ -77,6 +97,12 @@ impl TerminalEditor for DigitEditor { impl TerminalTreeEditor for DigitEditor {} +impl Diagnostics for DigitEditor { + fn get_msg_port(&self) -> OuterViewPort> { + self.msg.get_port().to_sequence() + } +} + pub struct PosIntEditor { radix: u32, digits_editor: PTYListEditor @@ -123,6 +149,12 @@ impl PosIntEditor { } } +impl Diagnostics for PosIntEditor { + fn get_msg_port(&self) -> OuterViewPort> { + self.digits_editor.get_msg_port() + } +} + impl TreeNav for PosIntEditor { fn get_cursor(&self) -> TreeCursor { self.digits_editor.get_cursor() @@ -140,9 +172,23 @@ impl TreeNav for PosIntEditor { impl TerminalEditor for PosIntEditor { fn get_term_view(&self) -> OuterViewPort { - self.digits_editor.editor - .get_seg_seq_view() - .pty_decorate(SeqDecorStyle::Hex, 0) + match self.radix { + 10 => { + self.digits_editor.editor + .get_seg_seq_view() + .pty_decorate(SeqDecorStyle::Plain, 0) + }, + 16 => { + self.digits_editor.editor + .get_seg_seq_view() + .pty_decorate(SeqDecorStyle::Hex, 0) + } + _ => { + self.digits_editor.editor + .get_seg_seq_view() + .pty_decorate(SeqDecorStyle::Plain, 0) + } + } } fn handle_terminal_event(&mut self, event: &TerminalEvent) -> TerminalEditorResult { diff --git a/nested/src/lib.rs b/nested/src/lib.rs index 9addcac..604bb3a 100644 --- a/nested/src/lib.rs +++ b/nested/src/lib.rs @@ -17,9 +17,10 @@ pub mod grid; pub mod vec; // editors -pub mod tree_nav; pub mod product; pub mod list; +pub mod tree_nav; +pub mod diagnostics; // high-level types pub mod char_editor; diff --git a/nested/src/list/pty_editor.rs b/nested/src/list/pty_editor.rs index 0f61c8b..f4510a9 100644 --- a/nested/src/list/pty_editor.rs +++ b/nested/src/list/pty_editor.rs @@ -13,6 +13,7 @@ use { TerminalView, }, tree_nav::{TerminalTreeEditor, TreeCursor, TreeNav, TreeNavResult}, + diagnostics::{Diagnostics}, vec::VecBuffer, color::{bg_style_from_depth, fg_style_from_depth} }, @@ -215,6 +216,30 @@ where ItemEditor: TerminalTreeEditor + ?Sized + Send + Sync + 'static } } +impl Diagnostics for PTYListEditor +where ItemEditor: TerminalTreeEditor + Diagnostics + ?Sized + Send + Sync + 'static +{ + fn get_msg_port(&self) -> OuterViewPort> { + self.editor + .get_data_port() + .enumerate() + .map( + |(idx, item_editor)| { + let idx = *idx; + item_editor.read().unwrap() + .get_msg_port() + .map( + move |msg| { + let mut msg = msg.clone(); + msg.addr.insert(0, idx); + msg + } + ) + } + ) + .flatten() + } +} impl TerminalTreeEditor for PTYListEditor where ItemEditor: TerminalTreeEditor + ?Sized + Send + Sync + 'static diff --git a/nested/src/product/editor.rs b/nested/src/product/editor.rs index 128e79a..27b0253 100644 --- a/nested/src/product/editor.rs +++ b/nested/src/product/editor.rs @@ -5,13 +5,15 @@ use { TerminalEditor, TerminalEditorResult, TerminalEvent, TerminalView }, - sequence::{SequenceView}, - tree_nav::{TreeNav, TerminalTreeEditor, TreeNavResult}, vec::{VecBuffer, MutableVecAccess}, index::{buffer::{IndexBuffer, MutableIndexAccess}, IndexView}, list::ListCursorMode, product::{segment::ProductEditorSegment}, - make_editor::make_editor + sequence::{SequenceView}, + make_editor::make_editor, + + tree_nav::{TreeNav, TerminalTreeEditor, TreeNavResult}, + diagnostics::{Diagnostics, Message}, }, cgmath::{Vector2, Point2}, std::sync::{Arc, RwLock}, @@ -20,6 +22,8 @@ use { }; pub struct ProductEditor { + msg_buf: VecBuffer>>>, + msg_port: OuterViewPort>, segments: IndexBuffer, ProductEditorSegment>, pub(super) n_indices: Vec>, @@ -30,8 +34,28 @@ pub struct ProductEditor { impl ProductEditor { pub fn new(depth: usize, ctx: Arc>) -> Self { + let msg_buf = VecBuffer::new(); ProductEditor { segments: IndexBuffer::new(), + msg_port: msg_buf.get_port() + .to_sequence() + .enumerate() + .filter_map(|(idx, msgs): &(usize, Option>>)| { + let idx = *idx; + if let Some(msgs) = msgs { + Some(msgs.map( + move |msg| { + let mut msg = msg.clone(); + msg.addr.insert(0, idx); + msg + })) + } else { + None + } + }) + .flatten(), + msg_buf, + n_indices: Vec::new(), ctx, cursor: None, @@ -42,17 +66,21 @@ impl ProductEditor { pub fn with_t(mut self, pos: Point2, t: &str) -> Self { self.segments.insert(pos, ProductEditorSegment::T(t.to_string(), self.depth)); self - } + } pub fn with_n(mut self, pos: Point2, n: TypeLadder) -> Self { self.segments.insert(pos, ProductEditorSegment::N{ - t: n, + t: n.clone(), editor: None, ed_depth: self.depth + 1, cur_depth: 0, cur_dist: isize::MAX }); self.n_indices.push(pos); + + let mut b = VecBuffer::new(); + b.push(crate::diagnostics::make_todo(crate::terminal::make_label(&format!("complete {}", self.ctx.read().unwrap().type_term_to_str(&n[0]))))); + self.msg_buf.push(Some(b.get_port().to_sequence())); self } @@ -101,7 +129,7 @@ impl ProductEditor { } pub fn update_segment(&mut self, idx: isize) { - if let Some(ProductEditorSegment::N{ t: _, editor, ed_depth: _, cur_depth, cur_dist }) = self.get_editor_segment_mut(idx).deref_mut() { + if let Some(ProductEditorSegment::N{ t, editor, ed_depth: _, cur_depth, cur_dist }) = self.get_editor_segment_mut(idx).deref_mut() { let cur = self.get_cursor(); if cur.tree_addr.len() > 0 { @@ -113,6 +141,16 @@ impl ProductEditor { } else { *cur_dist = isize::MAX; }; + + if let Some(e) = editor { + self.msg_buf.update(idx as usize, Some(e.read().unwrap().get_msg_port())); + } else { + let mut b = VecBuffer::new(); + b.push(crate::diagnostics::make_todo(crate::terminal::make_label(&format!("complete {}", self.ctx.read().unwrap().type_term_to_str(&t[0]))))); + + self.msg_buf.update(idx as usize, Some(b.get_port().to_sequence())); + } + } else { unreachable!() } @@ -139,14 +177,13 @@ impl TerminalEditor for ProductEditor { if let Some(ProductEditorSegment::N{ t, editor, ed_depth, cur_depth, cur_dist }) = segment.deref_mut() { *cur_depth = self.get_cursor().tree_addr.len(); - if let Some(e) = editor.clone() { + let result = if let Some(e) = editor.clone() { let mut ce = e.write().unwrap(); match ce.handle_terminal_event(event) { TerminalEditorResult::Exit => match event { TerminalEvent::Input(Event::Key(Key::Backspace)) => { *editor = None; - *cur_depth = 1; TerminalEditorResult::Continue } _ => { @@ -170,7 +207,10 @@ impl TerminalEditor for ProductEditor { let x = e.write().unwrap().handle_terminal_event(event); *cur_depth = e.write().unwrap().get_cursor().tree_addr.len(); x - } + }; + + self.update_cur_segment(); + result } else { unreachable!() } @@ -180,3 +220,10 @@ impl TerminalEditor for ProductEditor { } } +impl Diagnostics for ProductEditor { + fn get_msg_port(&self) -> OuterViewPort> { + self.msg_port.clone() + } +} + + diff --git a/nested/src/sequence/flatten.rs b/nested/src/sequence/flatten.rs index 355e383..8487563 100644 --- a/nested/src/sequence/flatten.rs +++ b/nested/src/sequence/flatten.rs @@ -117,6 +117,9 @@ where s.cast.notify(&(idx + chunk_offset)); s.cast.notify_each(dirty_idx); + } else { + let dirty_idx = s.update_all_offsets(); + s.cast.notify_each(dirty_idx); } }, ), @@ -124,7 +127,6 @@ where ); chunk_port.0.update(); - let dirty_idx = self.update_all_offsets(); self.cast.notify_each(dirty_idx); } else { @@ -161,8 +163,11 @@ where let old_length = self.length; self.length = cur_offset; - - dirty_idx.extend(self.length..old_length); +/* FIXXME: causes hangup + if self.length < old_length { + dirty_idx.extend(self.length..old_length); + } + */ dirty_idx } diff --git a/nested/src/tree_nav.rs b/nested/src/tree_nav.rs index 3079c4a..0c18c6a 100644 --- a/nested/src/tree_nav.rs +++ b/nested/src/tree_nav.rs @@ -150,6 +150,7 @@ pub trait TreeNav { } use crate::terminal::{TerminalEditor}; +use crate::diagnostics::{Diagnostics}; -pub trait TerminalTreeEditor : TerminalEditor + TreeNav + Send {} +pub trait TerminalTreeEditor : TerminalEditor + TreeNav + Diagnostics + Send {} diff --git a/shell/src/command.rs b/shell/src/command.rs index b1ef614..0c96337 100644 --- a/shell/src/command.rs +++ b/shell/src/command.rs @@ -8,7 +8,7 @@ use { nested::{ vec::VecBuffer, list::{ListEditor, PTYListEditor}, - sequence::decorator::{Separate, Wrap, SeqDecorStyle}, + sequence::{SequenceView, decorator::{Separate, Wrap, SeqDecorStyle}}, core::{TypeTerm, Context}, core::{OuterViewPort, ViewPort}, index::{IndexArea, IndexView}, @@ -17,6 +17,7 @@ use { TerminalAtom, TerminalEditor, TerminalEditorResult, TerminalEvent, TerminalStyle, TerminalView, make_label }, tree_nav::{TreeCursor, TreeNav, TreeNavResult, TerminalTreeEditor}, + diagnostics::{Diagnostics}, make_editor::make_editor, product::ProductEditor } @@ -76,6 +77,22 @@ impl Action for ActCp { } } +pub struct ActNum {} +impl Action for ActNum { + fn make_editor(&self, ctx: Arc>) -> Arc> { + let depth = 1; + Arc::new(RwLock::new(ProductEditor::new(depth, ctx.clone()) + .with_t(Point2::new(1, 1), " Value") + .with_n(Point2::new(0, 1), vec![ ctx.read().unwrap().type_term_from_str("( PosInt 16 BigEndian )").unwrap() ] ) + .with_t(Point2::new(1, 2), " Radix") + .with_n(Point2::new(0, 2), vec![ ctx.read().unwrap().type_term_from_str("( PosInt 10 BigEndian )").unwrap() ] ) + + )) as Arc> + +// Arc::new(RwLock::new(nested::integer::PosIntEditor::new(10))) + } +} + pub struct Commander { ctx: Arc>, cmds: HashMap>, @@ -87,6 +104,9 @@ pub struct Commander { view_elements: VecBuffer>, out_port: OuterViewPort, + + m_buf: VecBuffer>>, + msg_port: OuterViewPort> } impl Commander { @@ -123,7 +143,9 @@ impl Commander { cmds.insert("echo".into(), Arc::new(ActEcho{}) as Arc); cmds.insert("ls".into(), Arc::new(ActLs{}) as Arc); cmds.insert("cp".into(), Arc::new(ActCp{}) as Arc); + cmds.insert("num".into(), Arc::new(ActNum{}) as Arc); + let m_buf = VecBuffer::new(); let mut c = Commander { ctx, cmds, @@ -136,7 +158,12 @@ impl Commander { .to_sequence() .separate(make_label(" ")) .to_grid_horizontal() - .flatten() + .flatten(), + + msg_port: m_buf.get_port() + .to_sequence() + .flatten(), + m_buf }; c @@ -154,6 +181,8 @@ impl TerminalEditor for Commander { TerminalEvent::Input(Event::Key(Key::Char('\n'))) => { // run cmd_editor.write().unwrap().goto(TreeCursor::none()); + + TerminalEditorResult::Exit } event => { @@ -171,6 +200,8 @@ impl TerminalEditor for Commander { *self.view_elements.get_mut(1) = editor.read().unwrap().get_term_view(); + self.m_buf.push(editor.read().unwrap().get_msg_port()); + if *event == TerminalEvent::Input(Event::Key(Key::Char('\n'))) { return self.handle_terminal_event(event); } @@ -194,7 +225,6 @@ impl TerminalEditor for Commander { } else { *self.view_elements.get_mut(1) = editor.read().unwrap().get_term_view().map_item(|p,a| a.add_style_front(TerminalStyle::fg_color((80,80,80)))); } - self.cmd_editor = Some(editor); *self.valid.write().unwrap() = true; } else { @@ -213,6 +243,12 @@ impl TerminalEditor for Commander { } } +impl Diagnostics for Commander { + fn get_msg_port(&self) -> OuterViewPort> { + self.msg_port.clone() + } +} + impl TreeNav for Commander { fn get_cursor(&self) -> TreeCursor { if let (Some(cmd_editor), true) = (self.cmd_editor.as_ref(), self.confirmed) { @@ -242,7 +278,6 @@ impl TreeNav for Commander { self.symbol_editor.goto(cur) } } - } impl TerminalTreeEditor for Commander {} diff --git a/shell/src/main.rs b/shell/src/main.rs index 5b030f4..fda49a3 100644 --- a/shell/src/main.rs +++ b/shell/src/main.rs @@ -24,6 +24,8 @@ use { }, tree_nav::{TreeNav, TerminalTreeEditor, TreeCursor, TreeNavResult}, vec::VecBuffer, + integer::{PosIntEditor}, + diagnostics::{Diagnostics} }, std::sync::{Arc, RwLock}, termion::event::{Event, Key}, @@ -55,7 +57,17 @@ async fn main() { "PosInt", "Digit", "LittleEndian", "BigEndian", "DiffStream", "ℕ", "List", "Path", "Term", "RGB", "Vec3i" ] { ctx.write().unwrap().add_typename(tn.into()); } - +/* + let mut process_list_editor = PTYListEditor::new( + Box::new( + move || { + Arc::new(RwLock::new(PosIntEditor::new(16))) + } + ), + SeqDecorStyle::VerticalSexpr, + 0 + ); +*/ let mut process_list_editor = PTYListEditor::new( Box::new({let ctx = ctx.clone(); move || Arc::new(RwLock::new(Commander::new(ctx.clone())))}), /* @@ -70,7 +82,7 @@ async fn main() { SeqDecorStyle::VerticalSexpr, 0 ); - + async_std::task::spawn(async move { let mut table = nested::index::buffer::IndexBuffer::new(); @@ -86,19 +98,12 @@ async fn main() { let mut cur_size = nested::singleton::SingletonBuffer::new(Vector2::new(10, 10)); let mut status_chars = VecBuffer::new(); - - let mut plist = VecBuffer::new(); - let mut plist_port = plist.get_port(); - async_std::task::spawn(async move { - let (w, _h) = termion::terminal_size().unwrap(); - let mut x: usize = 0; - loop { - let val = (5.0 - + (x as f32 / 3.0).sin() * 5.0 - + 2.0 - + ((7 + x) as f32 / 5.0).sin() * 2.0 - + 2.0 - + ((9 + x) as f32 / 10.0).cos() * 3.0) as usize; + let mut plist = VecBuffer::new(); let mut plist_port = + plist.get_port(); async_std::task::spawn(async move { let (w, + _h) = termion::terminal_size().unwrap(); let mut x: usize = 0; + loop { let val = (5.0 + (x as f32 / 3.0).sin() * 5.0 + 2.0 + + ((7 + x) as f32 / 5.0).sin() * 2.0 + 2.0 + ((9 + x) as f32 / + 10.0).cos() * 3.0) as usize; if x < w as usize { plist.push(val); @@ -133,6 +138,36 @@ async fn main() { .separate(make_label(" ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~").map_item(|p,a| a.add_style_front(TerminalStyle::fg_color((40,40,40))))) .to_grid_vertical() .flatten()), + (Point2::new(0, 5), make_label(" ")), + (Point2::new(0, 6), make_label("-~~--~~--~~--~~--~~--~~--~~--~~--~~--~~").map_item(|p,a| a.add_style_front(TerminalStyle::fg_color((200,200,200))))), + (Point2::new(0, 7), process_list_editor.get_msg_port().map( + |entry| { + let mut b = VecBuffer::new(); + b.push( + make_label("@") + .map_item(|p,a| a + .add_style_back(TerminalStyle::bold(true)) + .add_style_back(TerminalStyle::fg_color((180,180,0)))) + ); + + for x in entry.addr.iter() { + b.push( + make_label(&format!("{}", x)) + ); + b.push( + make_label(".") + .map_item(|p,a| a + .add_style_back(TerminalStyle::bold(true)) + .add_style_back(TerminalStyle::fg_color((180,180,0)))) + ); + } + + b.push(entry.port.clone()); + + b.get_port().to_sequence().to_grid_horizontal().flatten() + } + ).to_grid_vertical().flatten()) + ]); let (w, h) = termion::terminal_size().unwrap(); @@ -219,7 +254,7 @@ async fn main() { term_port.inner().get_broadcast().notify(&IndexArea::Full); continue; } - +/* if let Some(process_editor) = process_list_editor.get_item() { let mut pe = process_editor.write().unwrap(); /* @@ -233,7 +268,7 @@ async fn main() { } */ } - +*/ match ev { TerminalEvent::Input(Event::Key(Key::Ctrl('d'))) => break, TerminalEvent::Input(Event::Key(Key::Ctrl('l'))) => { @@ -241,7 +276,7 @@ async fn main() { leaf_mode: ListCursorMode::Insert, tree_addr: vec![0], }); - process_list_editor.clear(); + //process_list_editor.clear(); } TerminalEvent::Input(Event::Key(Key::Left)) => { process_list_editor.pxev(); diff --git a/shell/src/process.rs b/shell/src/process.rs index c7f15bf..759ac9f 100644 --- a/shell/src/process.rs +++ b/shell/src/process.rs @@ -11,6 +11,7 @@ use { TerminalView, }, tree_nav::{TerminalTreeEditor, TreeCursor, TreeNav, TreeNavResult}, + diagnostics::Diagnostics }, std::sync::Arc, std::sync::RwLock, @@ -73,6 +74,9 @@ impl TreeNav for ProcessArg { } } +impl Diagnostics for ProcessArg { +} + impl TerminalTreeEditor for ProcessArg {} pub struct ProcessLauncher { @@ -263,4 +267,8 @@ impl TreeNav for ProcessLauncher { } +impl Diagnostics for ProcessLauncher { +} + impl TerminalTreeEditor for ProcessLauncher {} +