rename submodules to reprTree & editTree
This commit is contained in:
parent
b1c17da75f
commit
f3ad5c78d7
27 changed files with 61 additions and 87 deletions
|
@ -1,35 +1,24 @@
|
||||||
extern crate r3vi;
|
extern crate cgmath;
|
||||||
extern crate nested;
|
extern crate nested;
|
||||||
extern crate nested_tty;
|
extern crate nested_tty;
|
||||||
|
extern crate r3vi;
|
||||||
extern crate termion;
|
extern crate termion;
|
||||||
extern crate cgmath;
|
|
||||||
|
|
||||||
use {
|
use {
|
||||||
r3vi::view::{
|
|
||||||
ViewPort,
|
|
||||||
port::UpdateTask
|
|
||||||
},
|
|
||||||
nested::{
|
|
||||||
tree::{NestedNode},
|
|
||||||
type_system::{Context, ReprTree}
|
|
||||||
},
|
|
||||||
nested_tty::{
|
|
||||||
Terminal, TerminalView, TerminalEvent,
|
|
||||||
TerminalStyle,
|
|
||||||
TerminalCompositor
|
|
||||||
},
|
|
||||||
cgmath::Vector2,
|
cgmath::Vector2,
|
||||||
|
nested::reprTree::Context,
|
||||||
|
nested_tty::{Terminal, TerminalCompositor, TerminalEvent, TerminalStyle, TerminalView},
|
||||||
|
r3vi::view::{port::UpdateTask, ViewPort},
|
||||||
|
std::sync::{Arc, RwLock},
|
||||||
termion::event::{Event, Key},
|
termion::event::{Event, Key},
|
||||||
std::sync::{Arc, RwLock}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* this task handles all terminal events (e.g. key press, resize)
|
/* this task handles all terminal events (e.g. key press, resize)
|
||||||
*/
|
*/
|
||||||
pub async fn event_loop(
|
pub async fn event_loop(
|
||||||
mut term: Terminal,
|
mut term: Terminal,
|
||||||
term_port: ViewPort<dyn TerminalView>,
|
term_port: ViewPort<dyn TerminalView>,
|
||||||
portmutex: Arc<RwLock<()>>
|
portmutex: Arc<RwLock<()>>,
|
||||||
) {
|
) {
|
||||||
loop {
|
loop {
|
||||||
let ev = term.next_event().await;
|
let ev = term.next_event().await;
|
||||||
|
@ -46,10 +35,7 @@ pub async fn event_loop(
|
||||||
* all notifications which are influencing
|
* all notifications which are influencing
|
||||||
* the view in `term_port`
|
* the view in `term_port`
|
||||||
*/
|
*/
|
||||||
pub async fn update_loop(
|
pub async fn update_loop(term_port: ViewPort<dyn TerminalView>, portmutex: Arc<RwLock<()>>) {
|
||||||
term_port: ViewPort<dyn TerminalView>,
|
|
||||||
portmutex: Arc<RwLock<()>>
|
|
||||||
) {
|
|
||||||
loop {
|
loop {
|
||||||
{
|
{
|
||||||
let _l = portmutex.write().unwrap();
|
let _l = portmutex.write().unwrap();
|
||||||
|
@ -72,30 +58,28 @@ async fn main() {
|
||||||
|
|
||||||
/* spawn event-handling & updating tasks
|
/* spawn event-handling & updating tasks
|
||||||
*/
|
*/
|
||||||
async_std::task::spawn(
|
async_std::task::spawn(update_loop(term_port.clone(), portmutex.clone()));
|
||||||
update_loop(term_port.clone(), portmutex.clone()));
|
|
||||||
|
|
||||||
async_std::task::spawn(
|
async_std::task::spawn(event_loop(term, term_port.clone(), portmutex.clone()));
|
||||||
event_loop(term, term_port.clone(), portmutex.clone()));
|
|
||||||
|
|
||||||
/* populate the view in `term_port`
|
/* populate the view in `term_port`
|
||||||
*/
|
*/
|
||||||
let compositor = TerminalCompositor::new(term_port.inner());
|
let compositor = TerminalCompositor::new(term_port.inner());
|
||||||
|
|
||||||
compositor.write().unwrap().push(
|
compositor
|
||||||
nested_tty::make_label("test")
|
.write()
|
||||||
.offset(Vector2::new(7,2)));
|
.unwrap()
|
||||||
|
.push(nested_tty::make_label("test").offset(Vector2::new(7, 2)));
|
||||||
|
|
||||||
compositor.write().unwrap().push(
|
compositor.write().unwrap().push(
|
||||||
nested_tty::make_label("Hello World")
|
nested_tty::make_label("Hello World")
|
||||||
.map_item(|p,a|
|
.map_item(|p, a| {
|
||||||
a.add_style_back(
|
a.add_style_back(TerminalStyle::fg_color(((25 * p.x % 255) as u8, 200, 0)))
|
||||||
TerminalStyle::fg_color(( (25*p.x%255) as u8, 200, 0 )) ))
|
})
|
||||||
.offset(Vector2::new(5, 3)));
|
.offset(Vector2::new(5, 3)),
|
||||||
|
);
|
||||||
|
|
||||||
/* write the changes in the view of `term_port` to the terminal
|
/* write the changes in the view of `term_port` to the terminal
|
||||||
*/
|
*/
|
||||||
term_writer.show().await.expect("output error!");
|
term_writer.show().await.expect("output error!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,5 +7,5 @@ version = "0.1.0"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
r3vi = { path = "../../lib-r3vi" }
|
r3vi = { path = "../../lib-r3vi" }
|
||||||
laddertypes = { path = "../../lib-laddertypes" }
|
laddertypes = { path = "../../lib-laddertypes" }
|
||||||
cgmath = { version = "0.18.0", features = ["serde"] }
|
cgmath = { version = "0.18.0", features = ["serde"] }
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ use {
|
||||||
buffer::{vec::*, index_hashmap::*}
|
buffer::{vec::*, index_hashmap::*}
|
||||||
},
|
},
|
||||||
crate::{
|
crate::{
|
||||||
type_system::ReprTree
|
reprTree::ReprTree
|
||||||
},
|
},
|
||||||
std::sync::{Arc, RwLock},
|
std::sync::{Arc, RwLock},
|
||||||
cgmath::Point2
|
cgmath::Point2
|
|
@ -15,7 +15,7 @@ use {
|
||||||
},
|
},
|
||||||
crate::{
|
crate::{
|
||||||
editors::list::ListCursorMode,
|
editors::list::ListCursorMode,
|
||||||
tree::TreeCursor
|
editTree::TreeCursor
|
||||||
},
|
},
|
||||||
cgmath::Vector2,
|
cgmath::Vector2,
|
||||||
};
|
};
|
|
@ -7,8 +7,8 @@ use {
|
||||||
},
|
},
|
||||||
laddertypes::{TypeTerm},
|
laddertypes::{TypeTerm},
|
||||||
crate::{
|
crate::{
|
||||||
type_system::{ReprTree, Context},
|
reprTree::{ReprTree, Context},
|
||||||
tree::{TreeNav, TreeCursor, TreeNavResult, TreeHeightOp, diagnostics::{Diagnostics, Message}},
|
editTree::{TreeNav, TreeCursor, TreeNavResult, TreeHeightOp, diagnostics::{Diagnostics, Message}},
|
||||||
editors::{list::{ListCursorMode}, ObjCommander}
|
editors::{list::{ListCursorMode}, ObjCommander}
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -2,7 +2,7 @@
|
||||||
use {
|
use {
|
||||||
laddertypes::{TypeTerm, TypeID},
|
laddertypes::{TypeTerm, TypeID},
|
||||||
crate::{
|
crate::{
|
||||||
tree::{TreeAddr}
|
editTree::{TreeAddr}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,8 +8,8 @@ use {
|
||||||
},
|
},
|
||||||
laddertypes::{TypeTerm},
|
laddertypes::{TypeTerm},
|
||||||
crate::{
|
crate::{
|
||||||
type_system::{Context, ReprTree},
|
reprTree::{Context, ReprTree},
|
||||||
tree::{NestedNode, TreeNavResult},
|
editTree::{NestedNode, TreeNavResult},
|
||||||
editors::ObjCommander,
|
editors::ObjCommander,
|
||||||
},
|
},
|
||||||
std::sync::Arc,
|
std::sync::Arc,
|
||||||
|
|
|
@ -5,12 +5,12 @@ use {
|
||||||
},
|
},
|
||||||
laddertypes::{TypeTerm},
|
laddertypes::{TypeTerm},
|
||||||
crate::{
|
crate::{
|
||||||
type_system::{Context},
|
reprTree::{Context},
|
||||||
|
reprTree::{MorphismTypePattern},
|
||||||
editors::{
|
editors::{
|
||||||
list::*,
|
list::*,
|
||||||
integer::*
|
integer::*
|
||||||
},
|
},
|
||||||
type_system::{MorphismTypePattern},
|
|
||||||
},
|
},
|
||||||
std::sync::{Arc, RwLock}
|
std::sync::{Arc, RwLock}
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,9 +12,9 @@ use {
|
||||||
},
|
},
|
||||||
laddertypes::{TypeTerm},
|
laddertypes::{TypeTerm},
|
||||||
crate::{
|
crate::{
|
||||||
type_system::{Context, ReprTree},
|
|
||||||
editors::{list::{ListCmd}, ObjCommander},
|
editors::{list::{ListCmd}, ObjCommander},
|
||||||
tree::{NestedNode, TreeNav, TreeNavResult, TreeCursor, diagnostics::{Message}},
|
reprTree::{Context, ReprTree},
|
||||||
|
editTree::{NestedNode, TreeNav, TreeNavResult, TreeCursor, diagnostics::{Message}},
|
||||||
},
|
},
|
||||||
std::sync::Arc,
|
std::sync::Arc,
|
||||||
std::sync::RwLock,
|
std::sync::RwLock,
|
||||||
|
|
|
@ -4,8 +4,8 @@ use {
|
||||||
},
|
},
|
||||||
crate::{
|
crate::{
|
||||||
editors::{list::{ListEditor, ListCursor, ListCursorMode}, ObjCommander},
|
editors::{list::{ListEditor, ListCursor, ListCursorMode}, ObjCommander},
|
||||||
type_system::{Context, ReprTree},
|
reprTree::{Context, ReprTree},
|
||||||
tree::{NestedNode, TreeNav, TreeNavResult, TreeCursor},
|
editTree::{NestedNode, TreeNav, TreeNavResult, TreeCursor},
|
||||||
},
|
},
|
||||||
std::sync::{Arc, RwLock}
|
std::sync::{Arc, RwLock}
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@ use {
|
||||||
r3vi::{view::{OuterViewPort, singleton::*}},
|
r3vi::{view::{OuterViewPort, singleton::*}},
|
||||||
laddertypes::{TypeTerm},
|
laddertypes::{TypeTerm},
|
||||||
crate::{
|
crate::{
|
||||||
type_system::{Context},
|
reprTree::{Context},
|
||||||
editors::list::{ListEditor}//, PTYListController, PTYListStyle}
|
editors::list::{ListEditor}//, PTYListController, PTYListStyle}
|
||||||
},
|
},
|
||||||
std::sync::{Arc, RwLock}
|
std::sync::{Arc, RwLock}
|
||||||
|
|
|
@ -5,9 +5,9 @@ use {
|
||||||
},
|
},
|
||||||
laddertypes::{TypeTerm},
|
laddertypes::{TypeTerm},
|
||||||
crate::{
|
crate::{
|
||||||
type_system::{Context, ReprTree},
|
reprTree::{Context, ReprTree},
|
||||||
|
editTree::{NestedNode, TreeNav, TreeCursor, diagnostics::Diagnostics},
|
||||||
editors::{list::{ListCursor, ListCursorMode, ListCmd}, ObjCommander},
|
editors::{list::{ListCursor, ListCursorMode, ListCmd}, ObjCommander},
|
||||||
tree::{NestedNode, TreeNav, TreeCursor, diagnostics::Diagnostics},
|
|
||||||
},
|
},
|
||||||
std::sync::{Arc, RwLock}
|
std::sync::{Arc, RwLock}
|
||||||
};
|
};
|
||||||
|
@ -117,8 +117,7 @@ impl ListEditor {
|
||||||
.set_diag(e
|
.set_diag(e
|
||||||
.get_data_port()
|
.get_data_port()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(
|
.map(|(idx, item_editor)| {
|
||||||
|(idx, item_editor)| {
|
|
||||||
let idx = *idx;
|
let idx = *idx;
|
||||||
item_editor
|
item_editor
|
||||||
.get_msg_port()
|
.get_msg_port()
|
||||||
|
@ -129,8 +128,7 @@ impl ListEditor {
|
||||||
msg
|
msg
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
})
|
||||||
)
|
|
||||||
.flatten()
|
.flatten()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ use {
|
||||||
ListCursor, ListCursorMode,
|
ListCursor, ListCursorMode,
|
||||||
editor::ListEditor
|
editor::ListEditor
|
||||||
},
|
},
|
||||||
tree::{TreeCursor, TreeNav, TreeNavResult, TreeHeightOp}
|
editTree::{TreeCursor, TreeNav, TreeNavResult, TreeHeightOp}
|
||||||
},
|
},
|
||||||
cgmath::Vector2
|
cgmath::Vector2
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,7 +9,7 @@ use {
|
||||||
},
|
},
|
||||||
crate::{
|
crate::{
|
||||||
editors::list::{ListCursor, ListCursorMode},
|
editors::list::{ListCursor, ListCursorMode},
|
||||||
tree::{NestedNode}
|
editTree::{NestedNode}
|
||||||
},
|
},
|
||||||
std::sync::Arc,
|
std::sync::Arc,
|
||||||
std::sync::RwLock,
|
std::sync::RwLock,
|
||||||
|
|
|
@ -16,8 +16,8 @@ pub trait Commander {
|
||||||
|
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use crate::{
|
use crate::{
|
||||||
type_system::ReprTree,
|
reprTree::ReprTree,
|
||||||
tree::{nav::TreeNavResult}
|
editTree::nav::TreeNavResult
|
||||||
};
|
};
|
||||||
|
|
||||||
pub trait ObjCommander {
|
pub trait ObjCommander {
|
||||||
|
|
|
@ -9,8 +9,8 @@ use {
|
||||||
laddertypes::{TypeTerm},
|
laddertypes::{TypeTerm},
|
||||||
crate::{
|
crate::{
|
||||||
editors::{list::ListCursorMode, ObjCommander},
|
editors::{list::ListCursorMode, ObjCommander},
|
||||||
type_system::{Context, ReprTree},
|
reprTree::{Context, ReprTree},
|
||||||
tree::{TreeNav, TreeCursor, TreeNavResult, diagnostics::{Diagnostics, Message}, NestedNode},
|
editTree::{TreeNav, TreeCursor, TreeNavResult, diagnostics::{Diagnostics, Message}, NestedNode},
|
||||||
},
|
},
|
||||||
cgmath::{Vector2},
|
cgmath::{Vector2},
|
||||||
std::sync::{Arc, RwLock}
|
std::sync::{Arc, RwLock}
|
||||||
|
|
|
@ -3,9 +3,9 @@ use {
|
||||||
view::{singleton::*}
|
view::{singleton::*}
|
||||||
},
|
},
|
||||||
crate::{
|
crate::{
|
||||||
type_system::{Context, ReprTree},
|
reprTree::{Context, ReprTree},
|
||||||
|
editTree::{NestedNode, TreeNav, TreeNavResult, TreeCursor},
|
||||||
editors::{list::{ListEditor, ListCmd, ListCursorMode}, ObjCommander},
|
editors::{list::{ListEditor, ListCmd, ListCursorMode}, ObjCommander},
|
||||||
tree::{NestedNode, TreeNav, TreeNavResult, TreeCursor},
|
|
||||||
},
|
},
|
||||||
std::{sync::{Arc, RwLock}},
|
std::{sync::{Arc, RwLock}},
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ use {
|
||||||
},
|
},
|
||||||
laddertypes::{TypeTerm},
|
laddertypes::{TypeTerm},
|
||||||
crate::{
|
crate::{
|
||||||
type_system::{Context, MorphismTypePattern},
|
reprTree::{Context, MorphismTypePattern},
|
||||||
editors::{
|
editors::{
|
||||||
list::{ListEditor, ListSegmentSequence},
|
list::{ListEditor, ListSegmentSequence},
|
||||||
typeterm::{State, TypeTermEditor}
|
typeterm::{State, TypeTermEditor}
|
||||||
|
|
|
@ -11,9 +11,9 @@ use {
|
||||||
},
|
},
|
||||||
laddertypes::{TypeID, TypeTerm},
|
laddertypes::{TypeID, TypeTerm},
|
||||||
crate::{
|
crate::{
|
||||||
type_system::{Context, ReprTree},
|
reprTree::{Context, ReprTree},
|
||||||
|
editTree::{NestedNode, TreeNav, TreeNavResult, TreeCursor},
|
||||||
editors::{list::{ListCursorMode, ListEditor, ListCmd}, ObjCommander},
|
editors::{list::{ListCursorMode, ListEditor, ListCmd}, ObjCommander},
|
||||||
tree::{NestedNode, TreeNav, TreeNavResult, TreeCursor},
|
|
||||||
},
|
},
|
||||||
std::{sync::{Arc, RwLock}}
|
std::{sync::{Arc, RwLock}}
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@ use {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
crate::{
|
crate::{
|
||||||
tree::{TreeNav, TreeCursor, TreeNavResult, TreeHeightOp},
|
editTree::{TreeNav, TreeCursor, TreeNavResult, TreeHeightOp},
|
||||||
editors::{typeterm::TypeTermEditor, list::ListCursorMode}
|
editors::{typeterm::TypeTermEditor, list::ListCursorMode}
|
||||||
},
|
},
|
||||||
cgmath::Vector2
|
cgmath::Vector2
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
pub mod editors;
|
pub mod editors;
|
||||||
pub mod tree;
|
pub mod editTree;
|
||||||
pub mod type_system;
|
pub mod reprTree;
|
||||||
|
|
||||||
pub fn magic_header() {
|
|
||||||
eprintln!("<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>");
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ use {
|
||||||
r3vi::{view::{OuterViewPort, singleton::*}, buffer::{singleton::*}},
|
r3vi::{view::{OuterViewPort, singleton::*}, buffer::{singleton::*}},
|
||||||
laddertypes::{TypeDict, TypeTerm, TypeID},
|
laddertypes::{TypeDict, TypeTerm, TypeID},
|
||||||
crate::{
|
crate::{
|
||||||
type_system::{ReprTree},
|
reprTree::{ReprTree},
|
||||||
tree::NestedNode
|
editTree::NestedNode
|
||||||
},
|
},
|
||||||
std::{
|
std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
|
@ -1,9 +1,12 @@
|
||||||
|
pub mod context;
|
||||||
|
|
||||||
|
pub use {
|
||||||
|
context::{Context, MorphismMode, MorphismType, MorphismTypePattern},
|
||||||
|
};
|
||||||
|
|
||||||
use {
|
use {
|
||||||
r3vi::view::{AnyOuterViewPort, OuterViewPort, View},
|
r3vi::view::{AnyOuterViewPort, OuterViewPort, View},
|
||||||
laddertypes::{TypeTerm},
|
laddertypes::{TypeTerm},
|
||||||
crate::{
|
|
||||||
type_system::{Context}
|
|
||||||
},
|
|
||||||
std::{
|
std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
sync::{Arc, RwLock},
|
sync::{Arc, RwLock},
|
|
@ -1,8 +0,0 @@
|
||||||
pub mod context;
|
|
||||||
pub mod repr_tree;
|
|
||||||
|
|
||||||
pub use {
|
|
||||||
context::{Context, MorphismMode, MorphismType, MorphismTypePattern},
|
|
||||||
repr_tree::ReprTree
|
|
||||||
};
|
|
||||||
|
|
Loading…
Reference in a new issue