disable code causing deadlock
This commit is contained in:
parent
28970658c0
commit
981ec3438f
3 changed files with 40 additions and 45 deletions
|
@ -17,6 +17,7 @@ pub trait IndexView<Key> : View<Msg = Key> {
|
||||||
|
|
||||||
fn get(&self, key: &Key) -> Self::Item;
|
fn get(&self, key: &Key) -> Self::Item;
|
||||||
|
|
||||||
|
// todo: AreaIterator enum to switch between Allocated and Procedural area
|
||||||
fn area(&self) -> Option<Vec<Key>> {
|
fn area(&self) -> Option<Vec<Key>> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
55
src/main.rs
55
src/main.rs
|
@ -33,28 +33,6 @@ use {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TermLabel(String);
|
|
||||||
impl ImplIndexView for TermLabel {
|
|
||||||
type Key = Point2<i16>;
|
|
||||||
type Value = Option<TerminalAtom>;
|
|
||||||
|
|
||||||
fn get(&self, pos: &Point2<i16>) -> Option<TerminalAtom> {
|
|
||||||
if pos.y == 5 {
|
|
||||||
Some(TerminalAtom::from(self.0.chars().nth(pos.x as usize)?))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn area(&self) -> Option<Vec<Point2<i16>>> {
|
|
||||||
Some(
|
|
||||||
GridWindowIterator::from(
|
|
||||||
Point2::new(0, 5) .. Point2::new(self.0.chars().count() as i16, 6)
|
|
||||||
).collect()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
|
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
|
||||||
|
|
||||||
#[async_std::main]
|
#[async_std::main]
|
||||||
|
@ -77,7 +55,6 @@ async fn main() {
|
||||||
let window_size_port = ViewPort::new();
|
let window_size_port = ViewPort::new();
|
||||||
let window_size = SingletonBuffer::new(Vector2::new(0, 0), window_size_port.inner());
|
let window_size = SingletonBuffer::new(Vector2::new(0, 0), window_size_port.inner());
|
||||||
|
|
||||||
|
|
||||||
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
|
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
|
||||||
// string editor
|
// string editor
|
||||||
let edit_port = ViewPort::<dyn TerminalView>::new();
|
let edit_port = ViewPort::<dyn TerminalView>::new();
|
||||||
|
@ -103,7 +80,6 @@ async fn main() {
|
||||||
|
|
||||||
edit_o.write().unwrap().set_offset(Vector2::new(40, 4));
|
edit_o.write().unwrap().set_offset(Vector2::new(40, 4));
|
||||||
|
|
||||||
|
|
||||||
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
|
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
|
||||||
// stupid label animation
|
// stupid label animation
|
||||||
let label_port = ViewPort::<dyn TerminalView>::new();
|
let label_port = ViewPort::<dyn TerminalView>::new();
|
||||||
|
@ -133,7 +109,6 @@ async fn main() {
|
||||||
let vec_seq_port = ViewPort::new();
|
let vec_seq_port = ViewPort::new();
|
||||||
let vec_seq = sequence::VecSequence::new(vec_seq_port.inner());
|
let vec_seq = sequence::VecSequence::new(vec_seq_port.inner());
|
||||||
vec_port.add_observer(vec_seq.clone());
|
vec_port.add_observer(vec_seq.clone());
|
||||||
|
|
||||||
let vec_term_view = vec_seq_port.outer()
|
let vec_term_view = vec_seq_port.outer()
|
||||||
.to_index()
|
.to_index()
|
||||||
.map_key(
|
.map_key(
|
||||||
|
@ -163,12 +138,10 @@ async fn main() {
|
||||||
TerminalEvent::Input(Event::Key(Key::Home)) => editor.goto(0),
|
TerminalEvent::Input(Event::Key(Key::Home)) => editor.goto(0),
|
||||||
TerminalEvent::Input(Event::Key(Key::End)) => editor.goto_end(),
|
TerminalEvent::Input(Event::Key(Key::End)) => editor.goto_end(),
|
||||||
TerminalEvent::Input(Event::Key(Key::Char('\n'))) => {},
|
TerminalEvent::Input(Event::Key(Key::Char('\n'))) => {},
|
||||||
TerminalEvent::Input(Event::Key(Key::Char(c))) => {editor.insert(c); vec_buf.push(c); },
|
TerminalEvent::Input(Event::Key(Key::Char(c))) => editor.insert(c),
|
||||||
TerminalEvent::Input(Event::Key(Key::Delete)) => editor.delete(),
|
TerminalEvent::Input(Event::Key(Key::Delete)) => editor.delete(),
|
||||||
TerminalEvent::Input(Event::Key(Key::Backspace)) => { editor.prev(); editor.delete(); },
|
TerminalEvent::Input(Event::Key(Key::Backspace)) => { editor.prev(); editor.delete(); },
|
||||||
TerminalEvent::Input(Event::Key(Key::Ctrl('c'))) => {
|
TerminalEvent::Input(Event::Key(Key::Ctrl('c'))) => break,
|
||||||
break
|
|
||||||
}
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,7 +156,6 @@ async fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
|
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
|
||||||
|
|
||||||
struct Checkerboard;
|
struct Checkerboard;
|
||||||
impl ImplIndexView for Checkerboard {
|
impl ImplIndexView for Checkerboard {
|
||||||
type Key = Point2<i16>;
|
type Key = Point2<i16>;
|
||||||
|
@ -209,7 +181,29 @@ impl ImplIndexView for Checkerboard {
|
||||||
}
|
}
|
||||||
|
|
||||||
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
|
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
|
||||||
|
struct TermLabel(String);
|
||||||
|
impl ImplIndexView for TermLabel {
|
||||||
|
type Key = Point2<i16>;
|
||||||
|
type Value = Option<TerminalAtom>;
|
||||||
|
|
||||||
|
fn get(&self, pos: &Point2<i16>) -> Option<TerminalAtom> {
|
||||||
|
if pos.y == 5 {
|
||||||
|
Some(TerminalAtom::from(self.0.chars().nth(pos.x as usize)?))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn area(&self) -> Option<Vec<Point2<i16>>> {
|
||||||
|
Some(
|
||||||
|
GridWindowIterator::from(
|
||||||
|
Point2::new(0, 5) .. Point2::new(self.0.chars().count() as i16, 6)
|
||||||
|
).collect()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
|
||||||
struct ScrambleBackground;
|
struct ScrambleBackground;
|
||||||
impl ImplIndexView for ScrambleBackground {
|
impl ImplIndexView for ScrambleBackground {
|
||||||
type Key = Point2<i16>;
|
type Key = Point2<i16>;
|
||||||
|
@ -225,7 +219,6 @@ impl ImplIndexView for ScrambleBackground {
|
||||||
|
|
||||||
fn area(&self) -> Option<Vec<Point2<i16>>> {
|
fn area(&self) -> Option<Vec<Point2<i16>>> {
|
||||||
None
|
None
|
||||||
//Some(Point2::new(0,0) .. Point2::new(50,30))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,13 @@ impl Observer<dyn TerminalView> for CompositeLayer {
|
||||||
let comp = self.comp.upgrade().unwrap();
|
let comp = self.comp.upgrade().unwrap();
|
||||||
let mut c = comp.write().unwrap();
|
let mut c = comp.write().unwrap();
|
||||||
|
|
||||||
{
|
let mut v = &mut c.layers.get_mut(&self.idx).unwrap().1;
|
||||||
let old_view = c.layers[&self.idx].1.clone();
|
let old_view = v.clone();
|
||||||
c.layers.get_mut(&self.idx).unwrap().1 = view.clone();
|
*v = view.clone();
|
||||||
|
drop(v);
|
||||||
|
|
||||||
|
//todo: fixme: why does this cause a deadlock?
|
||||||
|
//c.update_range();
|
||||||
|
|
||||||
if let Some(old_view) = old_view {
|
if let Some(old_view) = old_view {
|
||||||
if let Some(area) = old_view.area() {
|
if let Some(area) = old_view.area() {
|
||||||
|
@ -41,9 +45,6 @@ impl Observer<dyn TerminalView> for CompositeLayer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c.update_range();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn notify(&self, pos: &Point2<i16>) {
|
fn notify(&self, pos: &Point2<i16>) {
|
||||||
self.comp
|
self.comp
|
||||||
.upgrade().unwrap()
|
.upgrade().unwrap()
|
||||||
|
@ -131,7 +132,7 @@ impl TerminalCompositor {
|
||||||
TerminalCompositeView {
|
TerminalCompositeView {
|
||||||
idx_count: 0,
|
idx_count: 0,
|
||||||
layers: HashMap::new(),
|
layers: HashMap::new(),
|
||||||
area: Some(Vec::new()),
|
area: None,//Some(Vec::new()),
|
||||||
cast: port.get_broadcast()
|
cast: port.get_broadcast()
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
Loading…
Reference in a new issue