fix warnings
This commit is contained in:
parent
35498a2fa7
commit
7a24111f08
23 changed files with 94 additions and 147 deletions
|
@ -1,21 +1,17 @@
|
|||
use {
|
||||
crate::{
|
||||
core::{OuterViewPort, ViewPort, Context},
|
||||
list::{ListEditor},
|
||||
sequence::{SequenceView, SequenceViewExt},
|
||||
core::{OuterViewPort, Context},
|
||||
singleton::{SingletonBuffer, SingletonView},
|
||||
terminal::{
|
||||
TerminalAtom, TerminalEditor, TerminalEditorResult, TerminalEvent, TerminalStyle,
|
||||
TerminalView,
|
||||
TerminalAtom,
|
||||
TerminalEvent,
|
||||
TerminalStyle
|
||||
},
|
||||
tree::{TreeCursor, TreeNav, TreeNavResult},
|
||||
diagnostics::Diagnostics,
|
||||
Nested, tree::NestedNode, Commander
|
||||
tree::NestedNode, Commander
|
||||
},
|
||||
std::sync::Arc,
|
||||
std::sync::RwLock,
|
||||
termion::event::{Event, Key},
|
||||
cgmath::Vector2
|
||||
termion::event::{Event, Key}
|
||||
};
|
||||
|
||||
pub struct CharEditor {
|
||||
|
|
|
@ -296,7 +296,7 @@ impl Context {
|
|||
}
|
||||
|
||||
pub fn get_editor_ctor(&self, ty: &TypeTerm) -> Option<Arc<dyn Fn(Arc<RwLock<Self>>, TypeTerm, usize) -> Option<Arc<RwLock<dyn Nested + Send + Sync>>> + Send + Sync>> {
|
||||
if let TypeTerm::Type{ id, args } = ty.clone() {
|
||||
if let TypeTerm::Type{ id, args: _ } = ty.clone() {
|
||||
if let Some(m) = self.editor_ctors.get(&id).cloned() {
|
||||
Some(m)
|
||||
} else {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use {
|
||||
crate::{
|
||||
core::{OuterViewPort, ViewPort},
|
||||
sequence::{SequenceView, SequenceViewExt, decorator::{PTYSeqDecorate, SeqDecorStyle}},
|
||||
core::{OuterViewPort},
|
||||
sequence::{SequenceView},
|
||||
vec::{VecBuffer},
|
||||
index::{buffer::IndexBuffer},
|
||||
terminal::{
|
||||
|
@ -28,13 +28,13 @@ pub fn make_error(msg: OuterViewPort<dyn TerminalView>) -> Message {
|
|||
mb.insert_iter(vec![
|
||||
(Point2::new(0, 0),
|
||||
make_label("error: ")
|
||||
.map_item(|p,a| a
|
||||
.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
|
||||
.map_item(|_p,a| a
|
||||
.add_style_back(TerminalStyle::fg_color((180,180,180))))
|
||||
)
|
||||
]);
|
||||
|
@ -50,13 +50,13 @@ pub fn make_warn(msg: OuterViewPort<dyn TerminalView>) -> Message {
|
|||
mb.insert_iter(vec![
|
||||
(Point2::new(0, 0),
|
||||
make_label("warning: ")
|
||||
.map_item(|p,a| a
|
||||
.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
|
||||
.map_item(|_p,a| a
|
||||
.add_style_back(TerminalStyle::fg_color((180,180,180))))
|
||||
)
|
||||
]);
|
||||
|
@ -72,13 +72,13 @@ pub fn make_todo(msg: OuterViewPort<dyn TerminalView>) -> Message {
|
|||
mb.insert_iter(vec![
|
||||
(Point2::new(0, 0),
|
||||
make_label("todo: ")
|
||||
.map_item(|p,a| a
|
||||
.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
|
||||
.map_item(|_p,a| a
|
||||
.add_style_back(TerminalStyle::fg_color((180,180,180))))
|
||||
)
|
||||
]);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
core::{InnerViewPort, Observer, ObserverBroadcast, OuterViewPort, View, ViewPort, port::UpdateTask},
|
||||
core::{InnerViewPort, Observer, ObserverBroadcast, OuterViewPort, View, ViewPort},
|
||||
grid::{GridView, GridWindowIterator},
|
||||
index::{IndexArea, IndexView},
|
||||
projection::ProjectionHelper,
|
||||
|
@ -174,8 +174,8 @@ where
|
|||
|
||||
for chunk_idx in GridWindowIterator::from(top_range.clone()) {
|
||||
if let Some(chunk) = self.chunks.get_mut(&chunk_idx) {
|
||||
let old_offset = chunk.offset;
|
||||
let old_limit = chunk.limit;
|
||||
let _old_offset = chunk.offset;
|
||||
let _old_limit = chunk.limit;
|
||||
|
||||
//chunk.limit = Point2::new( col_widths[chunk_idx.x as usize]-1, row_heights[chunk_idx.y as usize]-1 );
|
||||
chunk.limit = *chunk.view.area().range().end();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
core::{InnerViewPort, OuterViewPort, ViewPort, Observer, ObserverBroadcast, View},
|
||||
core::{InnerViewPort, OuterViewPort, ViewPort, View},
|
||||
index::{IndexArea, IndexView},
|
||||
},
|
||||
std::sync::RwLock,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
core::{OuterViewPort, ViewPort},
|
||||
core::{OuterViewPort},
|
||||
list::{PTYListEditor},
|
||||
sequence::{SequenceView, SequenceViewExt, decorator::{PTYSeqDecorate, SeqDecorStyle}},
|
||||
singleton::{SingletonBuffer, SingletonView},
|
||||
|
@ -77,7 +77,7 @@ impl TerminalEditor for DigitEditor {
|
|||
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))))),
|
||||
.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()));
|
||||
|
|
|
@ -2,23 +2,19 @@ use {
|
|||
crate::{
|
||||
core::{OuterViewPort, ViewPort},
|
||||
list::{
|
||||
ListCursor, ListCursorMode,
|
||||
ListCursor,
|
||||
ListSegment, ListSegmentSequence,
|
||||
segment::PTYSegment
|
||||
},
|
||||
sequence::{SequenceView},
|
||||
singleton::{SingletonBuffer, SingletonView},
|
||||
terminal::{
|
||||
make_label, TerminalEditor, TerminalEditorResult, TerminalEvent, TerminalStyle,
|
||||
TerminalView,
|
||||
},
|
||||
Nested,
|
||||
tree::{TreeCursor, TreeNav, TreeNavResult},
|
||||
vec::VecBuffer,
|
||||
color::{bg_style_from_depth, fg_style_from_depth}
|
||||
vec::VecBuffer
|
||||
},
|
||||
std::sync::{Arc, RwLock},
|
||||
termion::event::{Event, Key},
|
||||
};
|
||||
|
||||
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
|
||||
|
|
|
@ -1,24 +1,12 @@
|
|||
use {
|
||||
crate::{
|
||||
core::{OuterViewPort, ViewPort},
|
||||
list::{
|
||||
ListCursor, ListCursorMode,
|
||||
ListSegment, ListSegmentSequence,
|
||||
ListEditor
|
||||
},
|
||||
sequence::SequenceView,
|
||||
singleton::{SingletonBuffer, SingletonView},
|
||||
terminal::{
|
||||
make_label, TerminalEditor, TerminalEditorResult, TerminalEvent, TerminalStyle,
|
||||
TerminalView,
|
||||
},
|
||||
tree::{TreeCursor, TreeNav, TreeNavResult},
|
||||
vec::VecBuffer,
|
||||
color::{bg_style_from_depth, fg_style_from_depth},
|
||||
Nested
|
||||
},
|
||||
std::sync::{Arc, RwLock},
|
||||
termion::event::{Event, Key},
|
||||
cgmath::Vector2
|
||||
};
|
||||
|
||||
|
|
|
@ -1,21 +1,17 @@
|
|||
use {
|
||||
crate::{
|
||||
core::{OuterViewPort, ViewPort, TypeTerm},
|
||||
core::{OuterViewPort},
|
||||
list::{
|
||||
ListCursor, ListCursorMode,
|
||||
ListSegment, ListSegmentSequence,
|
||||
ListEditor
|
||||
},
|
||||
sequence::{SequenceView, decorator::{SeqDecorStyle, PTYSeqDecorate}},
|
||||
singleton::{SingletonBuffer, SingletonView},
|
||||
terminal::{
|
||||
make_label, TerminalEditor, TerminalEditorResult, TerminalEvent, TerminalStyle,
|
||||
TerminalEditor, TerminalEditorResult, TerminalEvent,
|
||||
TerminalView,
|
||||
},
|
||||
tree::{TreeCursor, TreeNav, TreeNavResult},
|
||||
diagnostics::{Diagnostics},
|
||||
vec::VecBuffer,
|
||||
color::{bg_style_from_depth, fg_style_from_depth},
|
||||
Nested
|
||||
},
|
||||
std::sync::{Arc, RwLock},
|
||||
|
@ -287,7 +283,6 @@ where ItemEditor: Nested + ?Sized + Send + Sync + 'static
|
|||
{}
|
||||
|
||||
use crate::{
|
||||
char_editor::CharEditor,
|
||||
sequence::SequenceViewExt,
|
||||
StringGen
|
||||
};
|
||||
|
|
|
@ -98,7 +98,7 @@ where ItemEditor: Nested + ?Sized + Send + Sync + 'static
|
|||
|
||||
fn get(&self, idx: &usize) -> Option<Self::Item> {
|
||||
let c = self.cursor.get();
|
||||
Some(if let Some(mut cur) = c.idx {
|
||||
Some(if let Some(cur) = c.idx {
|
||||
match c.mode {
|
||||
ListCursorMode::Select => {
|
||||
ListSegment::Item {
|
||||
|
@ -158,7 +158,7 @@ where ItemEditor: Nested + ?Sized + Send + Sync + 'static
|
|||
}),
|
||||
|
||||
data: proj_helper.new_sequence_arg(1, data_port, |s: &mut Self, idx| {
|
||||
if let Some(mut cur_idx) = s.cur_cursor.idx {
|
||||
if let Some(cur_idx) = s.cur_cursor.idx {
|
||||
match s.cur_cursor.mode {
|
||||
ListCursorMode::Insert => {
|
||||
if *idx < cur_idx as usize {
|
||||
|
|
|
@ -1,27 +1,22 @@
|
|||
use {
|
||||
crate::{
|
||||
core::{TypeTerm, TypeLadder, Context, OuterViewPort},
|
||||
terminal::{TerminalView, TerminalEditor, TerminalEvent, TerminalEditorResult, make_label},
|
||||
tree::{TreeNav},
|
||||
core::{TypeTerm, Context},
|
||||
integer::PosIntEditor,
|
||||
list::{ListEditor, PTYListEditor},
|
||||
list::{PTYListEditor},
|
||||
sequence::{decorator::{SeqDecorStyle}},
|
||||
product::editor::ProductEditor,
|
||||
sum::SumEditor,
|
||||
char_editor::CharEditor,
|
||||
diagnostics::Diagnostics,
|
||||
Nested
|
||||
},
|
||||
cgmath::{Vector2, Point2},
|
||||
std::sync::{Arc, RwLock},
|
||||
};
|
||||
|
||||
pub fn init_editor_ctx(parent: Arc<RwLock<Context>>) -> Arc<RwLock<Context>> {
|
||||
let mut ctx = Arc::new(RwLock::new(Context::with_parent(Some(parent))));
|
||||
let ctx = Arc::new(RwLock::new(Context::with_parent(Some(parent))));
|
||||
|
||||
ctx.write().unwrap().add_editor_ctor(
|
||||
"Char", Arc::new(
|
||||
|ctx: Arc<RwLock<Context>>, ty: TypeTerm, _depth: usize| {
|
||||
|ctx: Arc<RwLock<Context>>, _ty: TypeTerm, _depth: usize| {
|
||||
Some(
|
||||
Arc::new(RwLock::new(CharEditor::new_node(&ctx)))
|
||||
as Arc<RwLock<dyn Nested + Send + Sync>>)
|
||||
|
@ -34,7 +29,7 @@ pub fn init_editor_ctx(parent: Arc<RwLock<Context>>) -> Arc<RwLock<Context>> {
|
|||
|ctx: Arc<RwLock<Context>>, ty: TypeTerm, depth: usize| {
|
||||
match ty {
|
||||
TypeTerm::Type {
|
||||
id, args
|
||||
id: _, args
|
||||
} => {
|
||||
if args.len() > 0 {
|
||||
// todo: factor style out of type arGS
|
||||
|
@ -93,7 +88,7 @@ pub fn init_editor_ctx(parent: Arc<RwLock<Context>>) -> Arc<RwLock<Context>> {
|
|||
|
||||
ctx.write().unwrap().add_editor_ctor(
|
||||
"Symbol", Arc::new(
|
||||
|ctx: Arc<RwLock<Context>>, ty: TypeTerm, depth: usize| {
|
||||
|ctx: Arc<RwLock<Context>>, _ty: TypeTerm, depth: usize| {
|
||||
Context::make_editor(
|
||||
ctx.clone(),
|
||||
ctx.read().unwrap().type_term_from_str("( List Char 0 )").unwrap(),
|
||||
|
@ -105,7 +100,7 @@ pub fn init_editor_ctx(parent: Arc<RwLock<Context>>) -> Arc<RwLock<Context>> {
|
|||
|
||||
ctx.write().unwrap().add_editor_ctor(
|
||||
"String", Arc::new(
|
||||
|ctx: Arc<RwLock<Context>>, ty: TypeTerm, depth: usize| {
|
||||
|ctx: Arc<RwLock<Context>>, _ty: TypeTerm, depth: usize| {
|
||||
Context::make_editor(
|
||||
ctx.clone(),
|
||||
ctx.read().unwrap().type_term_from_str("( List Char 3 )").unwrap(),
|
||||
|
@ -117,7 +112,7 @@ pub fn init_editor_ctx(parent: Arc<RwLock<Context>>) -> Arc<RwLock<Context>> {
|
|||
|
||||
ctx.write().unwrap().add_editor_ctor(
|
||||
"TypeTerm", Arc::new(
|
||||
|ctx: Arc<RwLock<Context>>, ty: TypeTerm, depth: usize| {
|
||||
|ctx: Arc<RwLock<Context>>, _ty: TypeTerm, depth: usize| {
|
||||
let mut s = SumEditor::new(
|
||||
vec![
|
||||
Context::make_editor(ctx.clone(), ctx.read().unwrap().type_term_from_str("( Symbol )").unwrap(), depth+1).unwrap(),
|
||||
|
@ -140,17 +135,17 @@ pub fn init_editor_ctx(parent: Arc<RwLock<Context>>) -> Arc<RwLock<Context>> {
|
|||
}
|
||||
|
||||
pub fn init_math_ctx(parent: Arc<RwLock<Context>>) -> Arc<RwLock<Context>> {
|
||||
let mut ctx = Arc::new(RwLock::new(Context::with_parent(Some(parent))));
|
||||
let ctx = Arc::new(RwLock::new(Context::with_parent(Some(parent))));
|
||||
|
||||
ctx.write().unwrap().add_typename("MachineInt".into());
|
||||
ctx.write().unwrap().add_typename("Digit".into());
|
||||
ctx.write().unwrap().add_typename("BigEndian".into());
|
||||
ctx.write().unwrap().add_editor_ctor(
|
||||
"PosInt", Arc::new(
|
||||
|ctx: Arc<RwLock<Context>>, ty: TypeTerm, _depth: usize| {
|
||||
|_ctx: Arc<RwLock<Context>>, ty: TypeTerm, _depth: usize| {
|
||||
match ty {
|
||||
TypeTerm::Type {
|
||||
id, args
|
||||
id: _, args
|
||||
} => {
|
||||
if args.len() > 0 {
|
||||
match args[0] {
|
||||
|
@ -176,11 +171,11 @@ pub fn init_math_ctx(parent: Arc<RwLock<Context>>) -> Arc<RwLock<Context>> {
|
|||
}
|
||||
|
||||
pub fn init_os_ctx(parent: Arc<RwLock<Context>>) -> Arc<RwLock<Context>> {
|
||||
let mut ctx = Arc::new(RwLock::new(Context::with_parent(Some(parent))));
|
||||
let ctx = Arc::new(RwLock::new(Context::with_parent(Some(parent))));
|
||||
|
||||
ctx.write().unwrap().add_editor_ctor(
|
||||
"PathSegment", Arc::new(
|
||||
|ctx: Arc<RwLock<Context>>, ty: TypeTerm, depth: usize| {
|
||||
|ctx: Arc<RwLock<Context>>, _ty: TypeTerm, depth: usize| {
|
||||
Context::make_editor(
|
||||
ctx.clone(),
|
||||
ctx.read().unwrap().type_term_from_str("( List Char 0 )").unwrap(),
|
||||
|
@ -192,7 +187,7 @@ pub fn init_os_ctx(parent: Arc<RwLock<Context>>) -> Arc<RwLock<Context>> {
|
|||
|
||||
ctx.write().unwrap().add_editor_ctor(
|
||||
"Path", Arc::new(
|
||||
|ctx: Arc<RwLock<Context>>, ty: TypeTerm, depth: usize| {
|
||||
|ctx: Arc<RwLock<Context>>, _ty: TypeTerm, depth: usize| {
|
||||
Context::make_editor(
|
||||
ctx.clone(),
|
||||
ctx.read().unwrap().type_term_from_str("( List PathSegment 6 )").unwrap(),
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
use {
|
||||
crate::{
|
||||
core::{ViewPort, OuterViewPort, TypeLadder, Context},
|
||||
core::{OuterViewPort, TypeLadder, Context},
|
||||
terminal::{
|
||||
TerminalEditor, TerminalEditorResult,
|
||||
TerminalEvent, TerminalView
|
||||
},
|
||||
vec::{VecBuffer, MutableVecAccess},
|
||||
index::{buffer::{IndexBuffer, MutableIndexAccess}, IndexView},
|
||||
vec::{VecBuffer},
|
||||
index::{buffer::{IndexBuffer, MutableIndexAccess}},
|
||||
list::ListCursorMode,
|
||||
product::{segment::ProductEditorSegment},
|
||||
sequence::{SequenceView},
|
||||
tree::{TreeNav, TreeNavResult},
|
||||
diagnostics::{Diagnostics, Message},
|
||||
diagnostics::{Diagnostics},
|
||||
terminal::{TerminalStyle},
|
||||
Nested
|
||||
},
|
||||
cgmath::{Vector2, Point2},
|
||||
cgmath::{Point2},
|
||||
std::sync::{Arc, RwLock},
|
||||
termion::event::{Event, Key},
|
||||
std::ops::{Deref, DerefMut}
|
||||
std::ops::{DerefMut}
|
||||
};
|
||||
|
||||
pub struct ProductEditor {
|
||||
|
@ -155,7 +155,7 @@ impl ProductEditor {
|
|||
self.msg_buf.update(idx as usize, Some(b.get_port().to_sequence().map(
|
||||
|msg| {
|
||||
let mut msg = msg.clone();
|
||||
msg.port = msg.port.map_item(|p,a| a.add_style_back(TerminalStyle::bg_color((40,40,40))));
|
||||
msg.port = msg.port.map_item(|_p,a| a.add_style_back(TerminalStyle::bg_color((40,40,40))));
|
||||
msg
|
||||
}
|
||||
)));
|
||||
|
@ -189,7 +189,7 @@ impl TerminalEditor for ProductEditor {
|
|||
let mut update_segment = false;
|
||||
|
||||
let result = if let Some(mut segment) = self.get_cur_segment_mut().as_deref_mut() {
|
||||
if let Some(ProductEditorSegment::N{ t, editor, ed_depth, cur_depth, cur_dist }) = segment.deref_mut() {
|
||||
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() {
|
||||
|
@ -227,7 +227,6 @@ impl TerminalEditor for ProductEditor {
|
|||
}
|
||||
} else {
|
||||
unreachable!();
|
||||
TerminalEditorResult::Exit
|
||||
}
|
||||
} else {
|
||||
TerminalEditorResult::Exit
|
||||
|
|
|
@ -6,9 +6,8 @@ use {
|
|||
product::{segment::ProductEditorSegment, ProductEditor},
|
||||
Nested
|
||||
},
|
||||
cgmath::{Point2, Vector2},
|
||||
std::{sync::{Arc, RwLock}, ops::{Deref, DerefMut}},
|
||||
termion::event::{Event, Key},
|
||||
cgmath::{Vector2},
|
||||
std::{ops::{DerefMut}},
|
||||
};
|
||||
|
||||
impl TreeNav for ProductEditor {
|
||||
|
@ -56,7 +55,7 @@ impl TreeNav for ProductEditor {
|
|||
let old_cursor = self.cursor;
|
||||
|
||||
if let Some(mut segment) = self.get_cur_segment_mut() {
|
||||
if let Some(ProductEditorSegment::N{ t: _t, editor, ed_depth, cur_depth, cur_dist:_ }) = segment.deref_mut() {
|
||||
if let Some(ProductEditorSegment::N{ t: _t, editor, ed_depth: _, cur_depth: _, cur_dist:_ }) = segment.deref_mut() {
|
||||
if let Some(e) = editor {
|
||||
let mut e = e.write().unwrap();
|
||||
e.goto(TreeCursor::none());
|
||||
|
@ -67,7 +66,7 @@ impl TreeNav for ProductEditor {
|
|||
if c.tree_addr.len() > 0 {
|
||||
self.cursor = Some(crate::modulo(c.tree_addr.remove(0), self.n_indices.len() as isize));
|
||||
if let Some(mut element) = self.get_cur_segment_mut() {
|
||||
if let Some(ProductEditorSegment::N{ t, editor, ed_depth, cur_depth, cur_dist:_ }) = element.deref_mut() {
|
||||
if let Some(ProductEditorSegment::N{ t, editor, ed_depth, cur_depth: _, cur_dist:_ }) = element.deref_mut() {
|
||||
if let Some(e) = editor {
|
||||
e.write().unwrap().goto(c.clone());
|
||||
} else if c.tree_addr.len() > 0 {
|
||||
|
@ -90,7 +89,7 @@ impl TreeNav for ProductEditor {
|
|||
|
||||
TreeNavResult::Continue
|
||||
} else {
|
||||
if let Some(mut ed) = self.get_cur_editor() {
|
||||
if let Some(ed) = self.get_cur_editor() {
|
||||
ed.write().unwrap().goto(TreeCursor::none());
|
||||
}
|
||||
|
||||
|
@ -124,7 +123,7 @@ impl TreeNav for ProductEditor {
|
|||
if direction.y > 0 {
|
||||
// dn
|
||||
if let Some(mut element) = self.get_cur_segment_mut() {
|
||||
if let Some(ProductEditorSegment::N{ t, editor, ed_depth, cur_depth, cur_dist:_ }) = element.deref_mut() {
|
||||
if let Some(ProductEditorSegment::N{ t, editor, ed_depth, cur_depth: _, cur_dist:_ }) = element.deref_mut() {
|
||||
if let Some(e) = editor {
|
||||
let mut e = e.write().unwrap();
|
||||
e.goby(direction);
|
||||
|
@ -175,7 +174,7 @@ impl TreeNav for ProductEditor {
|
|||
let old_cursor = self.cursor;
|
||||
let nav_result =
|
||||
if let Some(mut element) = self.get_cur_segment_mut() {
|
||||
if let Some(ProductEditorSegment::N{ t, editor, ed_depth, cur_depth, cur_dist:_ }) = element.deref_mut() {
|
||||
if let Some(ProductEditorSegment::N{ t: _, editor, ed_depth: _, cur_depth, cur_dist:_ }) = element.deref_mut() {
|
||||
if let Some(e) = editor {
|
||||
let mut ce = e.write().unwrap();
|
||||
//\\//\\//\\//\\
|
||||
|
@ -193,7 +192,6 @@ impl TreeNav for ProductEditor {
|
|||
TreeNavResult::Continue
|
||||
} else {
|
||||
panic!("unplausible direction.y on exit");
|
||||
TreeNavResult::Continue
|
||||
}
|
||||
} else if direction.y > 0 {
|
||||
// dn
|
||||
|
|
|
@ -2,15 +2,13 @@ use {
|
|||
crate::{
|
||||
core::{OuterViewPort, TypeLadder, Context},
|
||||
terminal::{
|
||||
TerminalEditor, TerminalStyle, TerminalView,
|
||||
TerminalStyle, TerminalView,
|
||||
make_label
|
||||
},
|
||||
list::{ListCursorMode},
|
||||
color::{bg_style_from_depth, fg_style_from_depth},
|
||||
Nested
|
||||
},
|
||||
std::{sync::{Arc, RwLock}, ops::{Deref, DerefMut}},
|
||||
termion::event::{Event, Key},
|
||||
std::{sync::{Arc, RwLock}},
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -32,12 +30,12 @@ impl ProductEditorSegment {
|
|||
make_label(t.as_str())
|
||||
.map_item({
|
||||
let depth = *depth;
|
||||
move |i, x|
|
||||
move |_i, x|
|
||||
x.add_style_back(fg_style_from_depth(depth)).add_style_back(TerminalStyle::italic(true))
|
||||
}
|
||||
),
|
||||
|
||||
ProductEditorSegment::N { t: _, editor: Some(e), ed_depth, cur_depth, cur_dist } =>
|
||||
ProductEditorSegment::N { t: _, editor: Some(e), ed_depth, cur_depth: _, cur_dist } =>
|
||||
e.read().unwrap()
|
||||
.get_term_view()
|
||||
.map_item({
|
||||
|
@ -45,7 +43,7 @@ impl ProductEditorSegment {
|
|||
let d = *ed_depth;
|
||||
let cur_dist = *cur_dist;
|
||||
|
||||
move |i, x| {
|
||||
move |_i, x| {
|
||||
let c = e.read().unwrap().get_cursor();
|
||||
let cur_depth = c.tree_addr.len();
|
||||
let select =
|
||||
|
@ -65,11 +63,11 @@ impl ProductEditorSegment {
|
|||
ProductEditorSegment::N{ t, editor: None, ed_depth, cur_depth, cur_dist } =>
|
||||
make_label(&ctx.read().unwrap().type_term_to_str(&t[0]))
|
||||
.map_item({
|
||||
let cur_depth = *cur_depth;
|
||||
let ed_depth = *ed_depth;
|
||||
let _cur_depth = *cur_depth;
|
||||
let _ed_depth = *ed_depth;
|
||||
let cur_dist = *cur_dist;
|
||||
|
||||
move |i, x|
|
||||
move |_i, x|
|
||||
x.add_style_back(TerminalStyle::fg_color((215,140,95)))
|
||||
.add_style_back(bg_style_from_depth(if cur_dist == 0 { 0 } else { usize::MAX }))
|
||||
.add_style_back(TerminalStyle::bold(cur_dist == 0))
|
||||
|
|
|
@ -195,7 +195,7 @@ impl PTYSeqDecorate for OuterViewPort<dyn SequenceView<Item = OuterViewPort<dyn
|
|||
fn pty_decorate(
|
||||
&self,
|
||||
style: SeqDecorStyle,
|
||||
depth: usize
|
||||
_depth: usize
|
||||
) -> OuterViewPort<dyn TerminalView> {
|
||||
match style {
|
||||
SeqDecorStyle::Plain => self
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
core::{InnerViewPort, OuterViewPort, Observer, ObserverBroadcast, View, ViewPort},
|
||||
core::{InnerViewPort, OuterViewPort, View, ViewPort},
|
||||
singleton::SingletonView,
|
||||
},
|
||||
std::sync::RwLock,
|
||||
|
|
|
@ -1,24 +1,18 @@
|
|||
use {
|
||||
crate::{
|
||||
core::{ViewPort, OuterViewPort, TypeLadder, Context},
|
||||
core::{ViewPort, OuterViewPort},
|
||||
terminal::{
|
||||
TerminalEditor, TerminalEditorResult,
|
||||
TerminalEvent, TerminalView
|
||||
},
|
||||
vec::{VecBuffer, MutableVecAccess},
|
||||
index::{buffer::{IndexBuffer, MutableIndexAccess}, IndexView},
|
||||
list::ListCursorMode,
|
||||
product::{segment::ProductEditorSegment},
|
||||
sequence::{SequenceView},
|
||||
tree::{TreeNav, TreeCursor, TreeNavResult},
|
||||
diagnostics::{Diagnostics, Message},
|
||||
terminal::{TerminalStyle},
|
||||
Nested
|
||||
},
|
||||
cgmath::{Vector2, Point2},
|
||||
cgmath::{Vector2},
|
||||
std::sync::{Arc, RwLock},
|
||||
termion::event::{Event, Key},
|
||||
std::ops::{Deref, DerefMut}
|
||||
termion::event::{Key}
|
||||
};
|
||||
|
||||
pub struct SumEditor {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use {
|
||||
crate::list::ListCursorMode,
|
||||
cgmath::Vector2
|
||||
crate::list::ListCursorMode
|
||||
};
|
||||
|
||||
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
|
||||
|
|
|
@ -36,7 +36,7 @@ pub trait TreeNav {
|
|||
0
|
||||
}
|
||||
|
||||
fn goby(&mut self, direction: Vector2<isize>) -> TreeNavResult {
|
||||
fn goby(&mut self, _direction: Vector2<isize>) -> TreeNavResult {
|
||||
TreeNavResult::Exit
|
||||
}
|
||||
|
||||
|
|
|
@ -3,12 +3,11 @@ use {
|
|||
cgmath::Vector2,
|
||||
crate::{
|
||||
core::{ViewPort, OuterViewPort, AnyOuterViewPort, context::ReprTree, Context},
|
||||
singleton::{SingletonView, SingletonBuffer},
|
||||
singleton::{SingletonBuffer},
|
||||
sequence::SequenceView,
|
||||
terminal::{TerminalView, TerminalEvent, TerminalEditor, TerminalEditorResult},
|
||||
diagnostics::{Diagnostics, Message},
|
||||
tree::{TreeNav, TreeCursor, TreeNavResult},
|
||||
Commander, ObjCommander,
|
||||
tree::{TreeNav, TreeCursor, TreeNavResult}, ObjCommander,
|
||||
Nested
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
core::{ViewPort, OuterViewPort, TypeLadder, Context},
|
||||
core::{OuterViewPort, Context},
|
||||
terminal::{TerminalEvent, TerminalView, TerminalEditor, TerminalEditorResult},
|
||||
sequence::{SequenceView, decorator::SeqDecorStyle},
|
||||
list::{PTYListEditor},
|
||||
|
@ -11,11 +11,10 @@ use {
|
|||
integer::PosIntEditor,
|
||||
Nested
|
||||
},
|
||||
cgmath::{Vector2, Point2},
|
||||
termion::event::{Event, Key},
|
||||
cgmath::{Vector2},
|
||||
termion::event::{Key},
|
||||
std::{
|
||||
sync::{Arc, RwLock},
|
||||
any::Any
|
||||
sync::{Arc, RwLock}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -114,7 +113,7 @@ impl TerminalEditor for TypeTermEditor {
|
|||
},
|
||||
_ => {
|
||||
if *c == '(' {
|
||||
let mut child = Arc::new(RwLock::new(TypeTermEditor {
|
||||
let _child = Arc::new(RwLock::new(TypeTermEditor {
|
||||
ty: self.ty.clone(),
|
||||
node: SumEditor::new(
|
||||
vec![
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
core::{InnerViewPort, OuterViewPort, Observer, ObserverBroadcast, View, ViewPort},
|
||||
core::{InnerViewPort, OuterViewPort, View, ViewPort},
|
||||
vec::VecDiff,
|
||||
},
|
||||
std::sync::RwLock,
|
||||
|
|
|
@ -8,29 +8,20 @@ mod pty;
|
|||
mod plot;
|
||||
|
||||
use {
|
||||
crate::{
|
||||
// process::ProcessLauncher,
|
||||
// command::Commander
|
||||
},
|
||||
cgmath::{Point2, Vector2},
|
||||
nested::{
|
||||
core::{port::UpdateTask, Observer, OuterViewPort, AnyOuterViewPort, View, ViewPort, Context, TypeTerm, ReprTree},
|
||||
core::{port::UpdateTask, Observer, AnyOuterViewPort, ViewPort, Context, ReprTree},
|
||||
index::IndexArea,
|
||||
list::{ListCursorMode, PTYListEditor},
|
||||
sequence::{SequenceView, decorator::{SeqDecorStyle, Separate}},
|
||||
sequence::{decorator::{SeqDecorStyle}},
|
||||
terminal::{
|
||||
make_label, Terminal, TerminalAtom, TerminalCompositor, TerminalEditor,
|
||||
TerminalEditorResult, TerminalEvent, TerminalStyle, TerminalView,
|
||||
TerminalEditorResult, TerminalEvent, TerminalStyle,
|
||||
},
|
||||
tree::{TreeNav, TreeCursor, TreeNavResult},
|
||||
vec::VecBuffer,
|
||||
integer::{PosIntEditor},
|
||||
char_editor::CharEditor,
|
||||
product::ProductEditor,
|
||||
sum::SumEditor,
|
||||
diagnostics::{Diagnostics},
|
||||
index::{buffer::IndexBuffer},
|
||||
Nested
|
||||
index::{buffer::IndexBuffer}
|
||||
},
|
||||
std::sync::{Arc, RwLock},
|
||||
termion::event::{Event, Key},
|
||||
|
@ -44,7 +35,7 @@ async fn main() {
|
|||
let mut term = Terminal::new(term_port.outer());
|
||||
let term_writer = term.get_writer();
|
||||
|
||||
let mut portmutex = Arc::new(RwLock::new(()));
|
||||
let portmutex = Arc::new(RwLock::new(()));
|
||||
|
||||
// Update Loop //
|
||||
let tp = term_port.clone();
|
||||
|
@ -53,7 +44,7 @@ async fn main() {
|
|||
async move {
|
||||
loop {
|
||||
{
|
||||
let l = portmutex.write().unwrap();
|
||||
let _l = portmutex.write().unwrap();
|
||||
tp.update();
|
||||
}
|
||||
async_std::task::sleep(std::time::Duration::from_millis(10)).await;
|
||||
|
@ -67,12 +58,12 @@ async fn main() {
|
|||
let ctx = nested::make_editor::init_math_ctx(ctx);
|
||||
let ctx = nested::make_editor::init_os_ctx(ctx);
|
||||
|
||||
let mut vb = VecBuffer::<char>::new();
|
||||
let mut rt_char = ReprTree::new_leaf(
|
||||
let vb = VecBuffer::<char>::new();
|
||||
let rt_char = ReprTree::new_leaf(
|
||||
ctx.read().unwrap().type_term_from_str("( List Char )").unwrap(),
|
||||
AnyOuterViewPort::from(vb.get_port())
|
||||
);
|
||||
let mut rt_digit = ReprTree::upcast(&rt_char, ctx.read().unwrap().type_term_from_str("( List ( Digit 10 ) )").unwrap());
|
||||
let rt_digit = ReprTree::upcast(&rt_char, ctx.read().unwrap().type_term_from_str("( List ( Digit 10 ) )").unwrap());
|
||||
rt_digit.write().unwrap().insert_branch(
|
||||
ReprTree::new_leaf(
|
||||
ctx.read().unwrap().type_term_from_str("( List MachineInt )").unwrap(),
|
||||
|
@ -194,7 +185,7 @@ async fn main() {
|
|||
let mut b = VecBuffer::new();
|
||||
b.push(
|
||||
make_label("@")
|
||||
.map_item(|p,a| a
|
||||
.map_item(|_p,a| a
|
||||
.add_style_back(TerminalStyle::bold(true))
|
||||
.add_style_back(TerminalStyle::fg_color((120,120,0))))
|
||||
);
|
||||
|
@ -202,12 +193,12 @@ async fn main() {
|
|||
for x in entry.addr.iter() {
|
||||
b.push(
|
||||
make_label(&format!("{}", x))
|
||||
.map_item(|p,a| a
|
||||
.map_item(|_p,a| a
|
||||
.add_style_back(TerminalStyle::fg_color((0, 100, 20))))
|
||||
);
|
||||
b.push(
|
||||
make_label(".")
|
||||
.map_item(|p,a| a
|
||||
.map_item(|_p,a| a
|
||||
.add_style_back(TerminalStyle::bold(true))
|
||||
.add_style_back(TerminalStyle::fg_color((120,120,0))))
|
||||
);
|
||||
|
@ -218,7 +209,7 @@ async fn main() {
|
|||
.to_sequence()
|
||||
.to_grid_horizontal()
|
||||
.flatten()
|
||||
.map_item(move |p,a| {
|
||||
.map_item(move |_p,a| {
|
||||
let select = false;
|
||||
if select {
|
||||
a.add_style_back(TerminalStyle::fg_color((60,60,60)))
|
||||
|
@ -231,7 +222,7 @@ async fn main() {
|
|||
|
||||
]);
|
||||
|
||||
let (w, h) = termion::terminal_size().unwrap();
|
||||
let (_w, _h) = termion::terminal_size().unwrap();
|
||||
/*
|
||||
compositor
|
||||
.write()
|
||||
|
@ -251,7 +242,7 @@ async fn main() {
|
|||
|
||||
loop {
|
||||
let ev = term.next_event().await;
|
||||
let l = portmutex.write().unwrap();
|
||||
let _l = portmutex.write().unwrap();
|
||||
|
||||
if let TerminalEvent::Resize(new_size) = ev {
|
||||
cur_size.set(new_size);
|
||||
|
|
Loading…
Reference in a new issue