From 85b614a9bbec3dd0f203a460c2e36dc72fc1ad7e Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Tue, 28 Nov 2023 20:52:25 +0100 Subject: [PATCH] further restructuring --- examples/tty-01-hello/src/main.rs | 54 ++---------------- examples/tty-02-node/src/main.rs | 57 +++++++++++-------- .../src/{editTree => edit_tree}/addr.rs | 0 .../src/{editTree => edit_tree}/cursor.rs | 0 .../{editTree => edit_tree}/diagnostics.rs | 2 +- .../src/{editTree => edit_tree}/mod.rs | 0 .../src/{editTree => edit_tree}/nav.rs | 2 +- .../src/{editTree => edit_tree}/node.rs | 4 +- .../src/{editTree => edit_tree}/treetype.rs | 2 +- lib-nested-core/src/editors/char/mod.rs | 4 +- lib-nested-core/src/editors/integer/ctx.rs | 4 +- lib-nested-core/src/editors/integer/editor.rs | 4 +- lib-nested-core/src/editors/list/cmd.rs | 4 +- lib-nested-core/src/editors/list/ctx.rs | 2 +- lib-nested-core/src/editors/list/editor.rs | 4 +- lib-nested-core/src/editors/list/nav.rs | 2 +- lib-nested-core/src/editors/list/segment.rs | 2 +- lib-nested-core/src/editors/mod.rs | 4 +- lib-nested-core/src/editors/sum/editor.rs | 4 +- lib-nested-core/src/editors/typeterm/cmd.rs | 4 +- lib-nested-core/src/editors/typeterm/ctx.rs | 2 +- lib-nested-core/src/editors/typeterm/mod.rs | 4 +- lib-nested-core/src/editors/typeterm/nav.rs | 2 +- lib-nested-core/src/lib.rs | 9 +-- .../src/{reprTree => repr_tree}/context.rs | 4 +- .../src/{reprTree => repr_tree}/mod.rs | 0 lib-nested-tty/src/ansi_parser.rs | 3 +- lib-nested-tty/src/{atom.rs => atom/mod.rs} | 8 +-- lib-nested-tty/src/{ => atom}/style.rs | 0 lib-nested-tty/src/{ => edit-tree}/color.rs | 0 .../src/{ => edit-tree}/cursor_widget.rs | 0 .../src/{ => edit-tree}/diagnostics.rs | 0 lib-nested-tty/src/editors/char.rs | 0 .../src/{list_editor.rs => editors/list.rs} | 0 lib-nested-tty/src/editors/mod.rsr | 0 lib-nested-tty/src/editors/product.rs | 0 lib-nested-tty/src/editors/singleton.rs | 0 .../src/{sum_editor.rs => editors/sum.rs} | 0 lib-nested-tty/src/lib.rs | 22 ++++--- lib-nested-tty/src/terminal.rs | 3 +- lib-nested-tty/src/tty_application.rs | 4 +- 41 files changed, 95 insertions(+), 125 deletions(-) rename lib-nested-core/src/{editTree => edit_tree}/addr.rs (100%) rename lib-nested-core/src/{editTree => edit_tree}/cursor.rs (100%) rename lib-nested-core/src/{editTree => edit_tree}/diagnostics.rs (94%) rename lib-nested-core/src/{editTree => edit_tree}/mod.rs (100%) rename lib-nested-core/src/{editTree => edit_tree}/nav.rs (99%) rename lib-nested-core/src/{editTree => edit_tree}/node.rs (98%) rename lib-nested-core/src/{editTree => edit_tree}/treetype.rs (85%) rename lib-nested-core/src/{reprTree => repr_tree}/context.rs (99%) rename lib-nested-core/src/{reprTree => repr_tree}/mod.rs (100%) rename lib-nested-tty/src/{atom.rs => atom/mod.rs} (93%) rename lib-nested-tty/src/{ => atom}/style.rs (100%) rename lib-nested-tty/src/{ => edit-tree}/color.rs (100%) rename lib-nested-tty/src/{ => edit-tree}/cursor_widget.rs (100%) rename lib-nested-tty/src/{ => edit-tree}/diagnostics.rs (100%) create mode 100644 lib-nested-tty/src/editors/char.rs rename lib-nested-tty/src/{list_editor.rs => editors/list.rs} (100%) create mode 100644 lib-nested-tty/src/editors/mod.rsr create mode 100644 lib-nested-tty/src/editors/product.rs create mode 100644 lib-nested-tty/src/editors/singleton.rs rename lib-nested-tty/src/{sum_editor.rs => editors/sum.rs} (100%) diff --git a/examples/tty-01-hello/src/main.rs b/examples/tty-01-hello/src/main.rs index 45aae38..45856c0 100644 --- a/examples/tty-01-hello/src/main.rs +++ b/examples/tty-01-hello/src/main.rs @@ -6,65 +6,22 @@ extern crate termion; use { cgmath::Vector2, - nested::reprTree::Context, - nested_tty::{Terminal, TerminalCompositor, TerminalEvent, TerminalStyle, TerminalView}, + nested::repr_tree::Context, + nested_tty::{Terminal, TerminalCompositor, TTYApplication, TerminalEvent, TerminalStyle, TerminalView}, r3vi::view::{port::UpdateTask, ViewPort}, std::sync::{Arc, RwLock}, termion::event::{Event, Key}, }; -/* this task handles all terminal events (e.g. key press, resize) - */ -pub async fn event_loop( - mut term: Terminal, - term_port: ViewPort, - portmutex: Arc>, -) { - loop { - let ev = term.next_event().await; - let _l = portmutex.write().unwrap(); - - if ev == TerminalEvent::Input(Event::Key(Key::Ctrl('d'))) { - break; - } - term_port.update(); - } -} - -/* this task will continuously pull forward - * all notifications which are influencing - * the view in `term_port` - */ -pub async fn update_loop(term_port: ViewPort, portmutex: Arc>) { - loop { - { - let _l = portmutex.write().unwrap(); - term_port.update(); - } - async_std::task::sleep(std::time::Duration::from_millis(500)).await; - } -} - #[async_std::main] async fn main() { /* initialize our terminal */ - let term_port = ViewPort::new(); - - let mut term = Terminal::new(term_port.outer()); - let term_writer = term.get_writer(); - - let portmutex = Arc::new(RwLock::new(())); - - /* spawn event-handling & updating tasks - */ - async_std::task::spawn(update_loop(term_port.clone(), portmutex.clone())); - - async_std::task::spawn(event_loop(term, term_port.clone(), portmutex.clone())); + let tty_app = TTYApplication::new(|event| { /* handle event */ }); /* populate the view in `term_port` */ - let compositor = TerminalCompositor::new(term_port.inner()); + let compositor = TerminalCompositor::new(tty_app.port.inner()); compositor .write() @@ -81,5 +38,6 @@ async fn main() { /* write the changes in the view of `term_port` to the terminal */ - term_writer.show().await.expect("output error!"); + tty_app.show().await.expect("output error!"); } + diff --git a/examples/tty-02-node/src/main.rs b/examples/tty-02-node/src/main.rs index 3d80c77..fb5b1f8 100644 --- a/examples/tty-02-node/src/main.rs +++ b/examples/tty-02-node/src/main.rs @@ -7,8 +7,8 @@ extern crate termion; use { cgmath::Vector2, nested::{ - editTree::NestedNode, - reprTree::{Context, ReprTree}, + edit_tree::NestedNode, + repr_tree::{Context, ReprTree}, }, nested_tty::{ terminal::TermOutWriter, DisplaySegment, Terminal, TerminalAtom, TerminalCompositor, @@ -23,18 +23,37 @@ use { termion::event::{Event, Key}, }; +fn node_make_char_view( + node: NestedNode +) -> NestedNode { + let char_view = node.data + .read() + .unwrap() + .get_port::>() + .expect("unable to get Char-view") + .map(move |c| TerminalAtom::from(if c == '\0' { ' ' } else { c })) + .to_grid(); + + let mut display_rt = ReprTree::new(Context::parse(&node.ctx, "Display")); + + display_rt.insert_branch(ReprTree::new_leaf( + Context::parse(&node.ctx, "TerminalView"), + char_view.into(), + )); + + node.set_view( + Arc::new(RwLock::new(display_rt)) + ) +} + #[async_std::main] async fn main() { let app = TTYApplication::new( |ev| { /* event handler */ } ); - let compositor = TerminalCompositor::new(app.port.inner()); /* setup context & create Editor-Tree */ let ctx = Arc::new(RwLock::new(Context::default())); - // abstract data - let rt = ReprTree::from_char(&ctx, 'λ'); - let mut node = Context::make_node( &ctx, // node type @@ -44,25 +63,17 @@ async fn main() { ) .unwrap(); - /* add a display view to the node + // set abstract data + node.data = ReprTree::from_char(&ctx, 'Λ'); + + // add a display view to the node + node = node_make_char_view( node ); + + /* setup display view routed to `app.port` */ - let char_view = rt - .read() - .unwrap() - .get_port::>() - .expect("unable to get Char-view") - .map(move |c| TerminalAtom::from(if c == '\0' { ' ' } else { c })) - .to_grid(); - - let mut display_rt = ReprTree::new(Context::parse(&ctx, "Display")); - - display_rt.insert_branch(ReprTree::new_leaf( - Context::parse(&ctx, "TerminalView"), - char_view.into(), - )); - - node = node.set_view(Arc::new(RwLock::new(display_rt))); + let compositor = TerminalCompositor::new(app.port.inner()); + // add some views to the display compositor compositor.write().unwrap().push( nested_tty::make_label("Hello World") .map_item(|p, a| { diff --git a/lib-nested-core/src/editTree/addr.rs b/lib-nested-core/src/edit_tree/addr.rs similarity index 100% rename from lib-nested-core/src/editTree/addr.rs rename to lib-nested-core/src/edit_tree/addr.rs diff --git a/lib-nested-core/src/editTree/cursor.rs b/lib-nested-core/src/edit_tree/cursor.rs similarity index 100% rename from lib-nested-core/src/editTree/cursor.rs rename to lib-nested-core/src/edit_tree/cursor.rs diff --git a/lib-nested-core/src/editTree/diagnostics.rs b/lib-nested-core/src/edit_tree/diagnostics.rs similarity index 94% rename from lib-nested-core/src/editTree/diagnostics.rs rename to lib-nested-core/src/edit_tree/diagnostics.rs index 0983f5b..4b39a1f 100644 --- a/lib-nested-core/src/editTree/diagnostics.rs +++ b/lib-nested-core/src/edit_tree/diagnostics.rs @@ -4,7 +4,7 @@ use { buffer::{vec::*, index_hashmap::*} }, crate::{ - reprTree::ReprTree + repr_tree::ReprTree }, std::sync::{Arc, RwLock}, cgmath::Point2 diff --git a/lib-nested-core/src/editTree/mod.rs b/lib-nested-core/src/edit_tree/mod.rs similarity index 100% rename from lib-nested-core/src/editTree/mod.rs rename to lib-nested-core/src/edit_tree/mod.rs diff --git a/lib-nested-core/src/editTree/nav.rs b/lib-nested-core/src/edit_tree/nav.rs similarity index 99% rename from lib-nested-core/src/editTree/nav.rs rename to lib-nested-core/src/edit_tree/nav.rs index c2aca14..3dae406 100644 --- a/lib-nested-core/src/editTree/nav.rs +++ b/lib-nested-core/src/edit_tree/nav.rs @@ -15,7 +15,7 @@ use { }, crate::{ editors::list::ListCursorMode, - editTree::TreeCursor + edit_tree::TreeCursor }, cgmath::Vector2, }; diff --git a/lib-nested-core/src/editTree/node.rs b/lib-nested-core/src/edit_tree/node.rs similarity index 98% rename from lib-nested-core/src/editTree/node.rs rename to lib-nested-core/src/edit_tree/node.rs index ad66127..b2a8fca 100644 --- a/lib-nested-core/src/editTree/node.rs +++ b/lib-nested-core/src/edit_tree/node.rs @@ -7,8 +7,8 @@ use { }, laddertypes::{TypeTerm}, crate::{ - reprTree::{ReprTree, Context}, - editTree::{TreeNav, TreeCursor, TreeNavResult, TreeHeightOp, diagnostics::{Diagnostics, Message}}, + repr_tree::{ReprTree, Context}, + edit_tree::{TreeNav, TreeCursor, TreeNavResult, TreeHeightOp, diagnostics::{Diagnostics, Message}}, editors::{list::{ListCursorMode}, ObjCommander} } }; diff --git a/lib-nested-core/src/editTree/treetype.rs b/lib-nested-core/src/edit_tree/treetype.rs similarity index 85% rename from lib-nested-core/src/editTree/treetype.rs rename to lib-nested-core/src/edit_tree/treetype.rs index 4fed7a7..c3ad118 100644 --- a/lib-nested-core/src/editTree/treetype.rs +++ b/lib-nested-core/src/edit_tree/treetype.rs @@ -2,7 +2,7 @@ use { laddertypes::{TypeTerm, TypeID}, crate::{ - editTree::{TreeAddr} + edit_tree::{TreeAddr} } }; diff --git a/lib-nested-core/src/editors/char/mod.rs b/lib-nested-core/src/editors/char/mod.rs index 2fb66de..3262f2b 100644 --- a/lib-nested-core/src/editors/char/mod.rs +++ b/lib-nested-core/src/editors/char/mod.rs @@ -8,8 +8,8 @@ use { }, laddertypes::{TypeTerm}, crate::{ - reprTree::{Context, ReprTree}, - editTree::{NestedNode, TreeNavResult}, + repr_tree::{Context, ReprTree}, + edit_tree::{NestedNode, TreeNavResult}, editors::ObjCommander, }, std::sync::Arc, diff --git a/lib-nested-core/src/editors/integer/ctx.rs b/lib-nested-core/src/editors/integer/ctx.rs index 5f5859a..214ef8c 100644 --- a/lib-nested-core/src/editors/integer/ctx.rs +++ b/lib-nested-core/src/editors/integer/ctx.rs @@ -5,8 +5,8 @@ use { }, laddertypes::{TypeTerm}, crate::{ - reprTree::{Context}, - reprTree::{MorphismTypePattern}, + repr_tree::{Context}, + repr_tree::{MorphismTypePattern}, editors::{ list::*, integer::* diff --git a/lib-nested-core/src/editors/integer/editor.rs b/lib-nested-core/src/editors/integer/editor.rs index c58b984..fa8593a 100644 --- a/lib-nested-core/src/editors/integer/editor.rs +++ b/lib-nested-core/src/editors/integer/editor.rs @@ -13,8 +13,8 @@ use { laddertypes::{TypeTerm}, crate::{ editors::{list::{ListCmd}, ObjCommander}, - reprTree::{Context, ReprTree}, - editTree::{NestedNode, TreeNav, TreeNavResult, TreeCursor, diagnostics::{Message}}, + repr_tree::{Context, ReprTree}, + edit_tree::{NestedNode, TreeNav, TreeNavResult, TreeCursor, diagnostics::{Message}}, }, std::sync::Arc, std::sync::RwLock, diff --git a/lib-nested-core/src/editors/list/cmd.rs b/lib-nested-core/src/editors/list/cmd.rs index 59a28e7..d1cec0d 100644 --- a/lib-nested-core/src/editors/list/cmd.rs +++ b/lib-nested-core/src/editors/list/cmd.rs @@ -4,8 +4,8 @@ use { }, crate::{ editors::{list::{ListEditor, ListCursor, ListCursorMode}, ObjCommander}, - reprTree::{Context, ReprTree}, - editTree::{NestedNode, TreeNav, TreeNavResult, TreeCursor}, + repr_tree::{Context, ReprTree}, + edit_tree::{NestedNode, TreeNav, TreeNavResult, TreeCursor}, }, std::sync::{Arc, RwLock} }; diff --git a/lib-nested-core/src/editors/list/ctx.rs b/lib-nested-core/src/editors/list/ctx.rs index 67a73d1..2eefc7f 100644 --- a/lib-nested-core/src/editors/list/ctx.rs +++ b/lib-nested-core/src/editors/list/ctx.rs @@ -2,7 +2,7 @@ use { r3vi::{view::{OuterViewPort, singleton::*}}, laddertypes::{TypeTerm}, crate::{ - reprTree::{Context}, + repr_tree::{Context}, editors::list::{ListEditor}//, PTYListController, PTYListStyle} }, std::sync::{Arc, RwLock} diff --git a/lib-nested-core/src/editors/list/editor.rs b/lib-nested-core/src/editors/list/editor.rs index cc6e7f1..6776057 100644 --- a/lib-nested-core/src/editors/list/editor.rs +++ b/lib-nested-core/src/editors/list/editor.rs @@ -5,8 +5,8 @@ use { }, laddertypes::{TypeTerm}, crate::{ - reprTree::{Context, ReprTree}, - editTree::{NestedNode, TreeNav, TreeCursor, diagnostics::Diagnostics}, + repr_tree::{Context, ReprTree}, + edit_tree::{NestedNode, TreeNav, TreeCursor, diagnostics::Diagnostics}, editors::{list::{ListCursor, ListCursorMode, ListCmd}, ObjCommander}, }, std::sync::{Arc, RwLock} diff --git a/lib-nested-core/src/editors/list/nav.rs b/lib-nested-core/src/editors/list/nav.rs index 2976074..94b4731 100644 --- a/lib-nested-core/src/editors/list/nav.rs +++ b/lib-nested-core/src/editors/list/nav.rs @@ -11,7 +11,7 @@ use { ListCursor, ListCursorMode, editor::ListEditor }, - editTree::{TreeCursor, TreeNav, TreeNavResult, TreeHeightOp} + edit_tree::{TreeCursor, TreeNav, TreeNavResult, TreeHeightOp} }, cgmath::Vector2 }; diff --git a/lib-nested-core/src/editors/list/segment.rs b/lib-nested-core/src/editors/list/segment.rs index 8dcf003..9e23550 100644 --- a/lib-nested-core/src/editors/list/segment.rs +++ b/lib-nested-core/src/editors/list/segment.rs @@ -9,7 +9,7 @@ use { }, crate::{ editors::list::{ListCursor, ListCursorMode}, - editTree::{NestedNode} + edit_tree::{NestedNode} }, std::sync::Arc, std::sync::RwLock, diff --git a/lib-nested-core/src/editors/mod.rs b/lib-nested-core/src/editors/mod.rs index 849cb67..669b5d8 100644 --- a/lib-nested-core/src/editors/mod.rs +++ b/lib-nested-core/src/editors/mod.rs @@ -16,8 +16,8 @@ pub trait Commander { use std::sync::{Arc, RwLock}; use crate::{ - reprTree::ReprTree, - editTree::nav::TreeNavResult + repr_tree::ReprTree, + edit_tree::nav::TreeNavResult }; pub trait ObjCommander { diff --git a/lib-nested-core/src/editors/sum/editor.rs b/lib-nested-core/src/editors/sum/editor.rs index 919dcb5..aa71f01 100644 --- a/lib-nested-core/src/editors/sum/editor.rs +++ b/lib-nested-core/src/editors/sum/editor.rs @@ -9,8 +9,8 @@ use { laddertypes::{TypeTerm}, crate::{ editors::{list::ListCursorMode, ObjCommander}, - reprTree::{Context, ReprTree}, - editTree::{TreeNav, TreeCursor, TreeNavResult, diagnostics::{Diagnostics, Message}, NestedNode}, + repr_tree::{Context, ReprTree}, + edit_tree::{TreeNav, TreeCursor, TreeNavResult, diagnostics::{Diagnostics, Message}, NestedNode}, }, cgmath::{Vector2}, std::sync::{Arc, RwLock} diff --git a/lib-nested-core/src/editors/typeterm/cmd.rs b/lib-nested-core/src/editors/typeterm/cmd.rs index cf62d80..4885ed1 100644 --- a/lib-nested-core/src/editors/typeterm/cmd.rs +++ b/lib-nested-core/src/editors/typeterm/cmd.rs @@ -3,8 +3,8 @@ use { view::{singleton::*} }, crate::{ - reprTree::{Context, ReprTree}, - editTree::{NestedNode, TreeNav, TreeNavResult, TreeCursor}, + repr_tree::{Context, ReprTree}, + edit_tree::{NestedNode, TreeNav, TreeNavResult, TreeCursor}, editors::{list::{ListEditor, ListCmd, ListCursorMode}, ObjCommander}, }, std::{sync::{Arc, RwLock}}, diff --git a/lib-nested-core/src/editors/typeterm/ctx.rs b/lib-nested-core/src/editors/typeterm/ctx.rs index cb9c1f9..0039c8f 100644 --- a/lib-nested-core/src/editors/typeterm/ctx.rs +++ b/lib-nested-core/src/editors/typeterm/ctx.rs @@ -4,7 +4,7 @@ use { }, laddertypes::{TypeTerm}, crate::{ - reprTree::{Context, MorphismTypePattern}, + repr_tree::{Context, MorphismTypePattern}, editors::{ list::{ListEditor, ListSegmentSequence}, typeterm::{State, TypeTermEditor} diff --git a/lib-nested-core/src/editors/typeterm/mod.rs b/lib-nested-core/src/editors/typeterm/mod.rs index 2536c4e..2134be4 100644 --- a/lib-nested-core/src/editors/typeterm/mod.rs +++ b/lib-nested-core/src/editors/typeterm/mod.rs @@ -11,8 +11,8 @@ use { }, laddertypes::{TypeID, TypeTerm}, crate::{ - reprTree::{Context, ReprTree}, - editTree::{NestedNode, TreeNav, TreeNavResult, TreeCursor}, + repr_tree::{Context, ReprTree}, + edit_tree::{NestedNode, TreeNav, TreeNavResult, TreeCursor}, editors::{list::{ListCursorMode, ListEditor, ListCmd}, ObjCommander}, }, std::{sync::{Arc, RwLock}} diff --git a/lib-nested-core/src/editors/typeterm/nav.rs b/lib-nested-core/src/editors/typeterm/nav.rs index 4439165..b4f2175 100644 --- a/lib-nested-core/src/editors/typeterm/nav.rs +++ b/lib-nested-core/src/editors/typeterm/nav.rs @@ -7,7 +7,7 @@ use { } }, crate::{ - editTree::{TreeNav, TreeCursor, TreeNavResult, TreeHeightOp}, + edit_tree::{TreeNav, TreeCursor, TreeNavResult, TreeHeightOp}, editors::{typeterm::TypeTermEditor, list::ListCursorMode} }, cgmath::Vector2 diff --git a/lib-nested-core/src/lib.rs b/lib-nested-core/src/lib.rs index c0ef04d..bca12dc 100644 --- a/lib-nested-core/src/lib.rs +++ b/lib-nested-core/src/lib.rs @@ -1,5 +1,6 @@ -pub mod utils; -pub mod editors; -pub mod editTree; -pub mod reprTree; + +pub mod repr_tree; +pub mod edit_tree; +pub mod editors; +pub mod utils; diff --git a/lib-nested-core/src/reprTree/context.rs b/lib-nested-core/src/repr_tree/context.rs similarity index 99% rename from lib-nested-core/src/reprTree/context.rs rename to lib-nested-core/src/repr_tree/context.rs index 9bfc9f9..3934246 100644 --- a/lib-nested-core/src/reprTree/context.rs +++ b/lib-nested-core/src/repr_tree/context.rs @@ -2,8 +2,8 @@ r3vi::{view::{OuterViewPort, singleton::*}, buffer::{singleton::*}}, laddertypes::{TypeDict, TypeTerm, TypeID}, crate::{ - reprTree::{ReprTree}, - editTree::NestedNode + repr_tree::{ReprTree}, + edit_tree::NestedNode }, std::{ collections::HashMap, diff --git a/lib-nested-core/src/reprTree/mod.rs b/lib-nested-core/src/repr_tree/mod.rs similarity index 100% rename from lib-nested-core/src/reprTree/mod.rs rename to lib-nested-core/src/repr_tree/mod.rs diff --git a/lib-nested-tty/src/ansi_parser.rs b/lib-nested-tty/src/ansi_parser.rs index efd8a83..399bf15 100644 --- a/lib-nested-tty/src/ansi_parser.rs +++ b/lib-nested-tty/src/ansi_parser.rs @@ -10,7 +10,8 @@ use { projection::projection_helper::ProjectionHelper, }, crate::{ - TerminalAtom, TerminalStyle, TerminalView, + atom::{TerminalAtom, TerminalStyle}, + TerminalView, }, cgmath::{Point2, Vector2}, std::io::Read, diff --git a/lib-nested-tty/src/atom.rs b/lib-nested-tty/src/atom/mod.rs similarity index 93% rename from lib-nested-tty/src/atom.rs rename to lib-nested-tty/src/atom/mod.rs index 2cd4d29..0bc55f1 100644 --- a/lib-nested-tty/src/atom.rs +++ b/lib-nested-tty/src/atom/mod.rs @@ -1,7 +1,7 @@ -use { - super::TerminalStyle, - serde::{Deserialize, Serialize}, -}; +pub mod style; +pub use style::TerminalStyle; + +use serde::{Deserialize, Serialize}; #[derive(Clone, Copy, Serialize, Deserialize, Debug)] pub struct TerminalAtom { diff --git a/lib-nested-tty/src/style.rs b/lib-nested-tty/src/atom/style.rs similarity index 100% rename from lib-nested-tty/src/style.rs rename to lib-nested-tty/src/atom/style.rs diff --git a/lib-nested-tty/src/color.rs b/lib-nested-tty/src/edit-tree/color.rs similarity index 100% rename from lib-nested-tty/src/color.rs rename to lib-nested-tty/src/edit-tree/color.rs diff --git a/lib-nested-tty/src/cursor_widget.rs b/lib-nested-tty/src/edit-tree/cursor_widget.rs similarity index 100% rename from lib-nested-tty/src/cursor_widget.rs rename to lib-nested-tty/src/edit-tree/cursor_widget.rs diff --git a/lib-nested-tty/src/diagnostics.rs b/lib-nested-tty/src/edit-tree/diagnostics.rs similarity index 100% rename from lib-nested-tty/src/diagnostics.rs rename to lib-nested-tty/src/edit-tree/diagnostics.rs diff --git a/lib-nested-tty/src/editors/char.rs b/lib-nested-tty/src/editors/char.rs new file mode 100644 index 0000000..e69de29 diff --git a/lib-nested-tty/src/list_editor.rs b/lib-nested-tty/src/editors/list.rs similarity index 100% rename from lib-nested-tty/src/list_editor.rs rename to lib-nested-tty/src/editors/list.rs diff --git a/lib-nested-tty/src/editors/mod.rsr b/lib-nested-tty/src/editors/mod.rsr new file mode 100644 index 0000000..e69de29 diff --git a/lib-nested-tty/src/editors/product.rs b/lib-nested-tty/src/editors/product.rs new file mode 100644 index 0000000..e69de29 diff --git a/lib-nested-tty/src/editors/singleton.rs b/lib-nested-tty/src/editors/singleton.rs new file mode 100644 index 0000000..e69de29 diff --git a/lib-nested-tty/src/sum_editor.rs b/lib-nested-tty/src/editors/sum.rs similarity index 100% rename from lib-nested-tty/src/sum_editor.rs rename to lib-nested-tty/src/editors/sum.rs diff --git a/lib-nested-tty/src/lib.rs b/lib-nested-tty/src/lib.rs index 4c1c7f6..687ceca 100644 --- a/lib-nested-tty/src/lib.rs +++ b/lib-nested-tty/src/lib.rs @@ -1,10 +1,9 @@ #![feature(trait_alias)] -//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> +// <<<<>>>><<>><><<>><<< * >>><<>><><<>><<<<>>>> \\ pub mod atom; -pub mod style; pub mod compositor; pub mod ansi_parser; @@ -12,26 +11,25 @@ pub mod ansi_parser; pub mod terminal; pub mod tty_application; -//pub mod list_editor; +//pub mod edit_tree; //pub mod widgets; -//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> +// <<<<>>>><<>><><<>><<< * >>><<>><><<>><<<<>>>> \\ pub use { - atom::TerminalAtom, - compositor::TerminalCompositor, - style::TerminalStyle, + atom::{TerminalAtom, TerminalStyle}, terminal::{Terminal, TerminalEvent}, - tty_application::TTYApplication + tty_application::TTYApplication, + compositor::TerminalCompositor, }; use r3vi::view::grid::*; -//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> +// <<<<>>>><<>><><<>><<< * >>><<>><><<>><<<<>>>> \\ pub trait TerminalView = GridView; -//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> +// <<<<>>>><<>><><<>><<< * >>><<>><><<>><<<<>>>> \\ use r3vi::view::OuterViewPort; @@ -40,10 +38,10 @@ pub trait DisplaySegment { } -use nested::reprTree::Context; +use nested::repr_tree::Context; use std::sync::{Arc, RwLock}; -impl DisplaySegment for nested::editTree::NestedNode { +impl DisplaySegment for nested::edit_tree::NestedNode { fn display_view(&self) -> OuterViewPort { self.view.as_ref().unwrap() .read().unwrap() diff --git a/lib-nested-tty/src/terminal.rs b/lib-nested-tty/src/terminal.rs index a7169c4..4cfa510 100644 --- a/lib-nested-tty/src/terminal.rs +++ b/lib-nested-tty/src/terminal.rs @@ -7,7 +7,8 @@ use { index::*, } }, - super::{TerminalStyle, TerminalView}, + crate::atom::{TerminalStyle}, + crate::{TerminalView}, async_std::{stream::StreamExt, task}, cgmath::{Point2, Vector2}, signal_hook, diff --git a/lib-nested-tty/src/tty_application.rs b/lib-nested-tty/src/tty_application.rs index aeb3fbb..fe4e48f 100644 --- a/lib-nested-tty/src/tty_application.rs +++ b/lib-nested-tty/src/tty_application.rs @@ -1,8 +1,8 @@ use { cgmath::Vector2, nested::{ - editTree::NestedNode, - reprTree::{Context, ReprTree}, + edit_tree::NestedNode, + repr_tree::{Context, ReprTree}, }, crate::{ terminal::TermOutWriter, DisplaySegment, Terminal, TerminalAtom, TerminalCompositor,