process editor: write keyboard input to pty
This commit is contained in:
parent
b9e285acb4
commit
c9c6958a62
5 changed files with 263 additions and 117 deletions
nested/src
|
@ -14,15 +14,15 @@ use {
|
|||
}
|
||||
};
|
||||
|
||||
pub struct SingletonBufferView<T: Clone + Eq + Send + Sync + 'static>(Arc<RwLock<T>>);
|
||||
pub struct SingletonBufferView<T: Clone + Send + Sync + 'static>(Arc<RwLock<T>>);
|
||||
|
||||
impl<T> View for SingletonBufferView<T>
|
||||
where T: Clone + Eq + Send + Sync + 'static {
|
||||
where T: Clone + Send + Sync + 'static {
|
||||
type Msg = ();
|
||||
}
|
||||
|
||||
impl<T> SingletonView for SingletonBufferView<T>
|
||||
where T: Clone + Eq + Send + Sync + 'static {
|
||||
where T: Clone + Send + Sync + 'static {
|
||||
type Item = T;
|
||||
|
||||
fn get(&self) -> Self::Item {
|
||||
|
@ -32,13 +32,13 @@ where T: Clone + Eq + Send + Sync + 'static {
|
|||
|
||||
#[derive(Clone)]
|
||||
pub struct SingletonBuffer<T>
|
||||
where T: Clone + Eq + Send + Sync + 'static {
|
||||
where T: Clone + Send + Sync + 'static {
|
||||
value: Arc<RwLock<T>>,
|
||||
cast: Arc<RwLock<ObserverBroadcast<dyn SingletonView<Item = T>>>>
|
||||
}
|
||||
|
||||
impl<T> SingletonBuffer<T>
|
||||
where T: Clone + Eq + Send + Sync + 'static {
|
||||
where T: Clone + Send + Sync + 'static {
|
||||
pub fn new(
|
||||
value: T,
|
||||
port: InnerViewPort<dyn SingletonView<Item = T>>
|
||||
|
@ -56,6 +56,16 @@ where T: Clone + Eq + Send + Sync + 'static {
|
|||
self.value.read().unwrap().clone()
|
||||
}
|
||||
|
||||
pub fn set(&mut self, new_value: T) {
|
||||
let mut v = self.value.write().unwrap();
|
||||
*v = new_value;
|
||||
drop(v);
|
||||
self.cast.notify(&());
|
||||
}
|
||||
}
|
||||
/*
|
||||
impl<T> SingletonBuffer<T>
|
||||
where T: Clone + Eq + Send + Sync + 'static {
|
||||
pub fn set(&mut self, new_value: T) {
|
||||
let mut v = self.value.write().unwrap();
|
||||
if *v != new_value {
|
||||
|
@ -65,6 +75,6 @@ where T: Clone + Eq + Send + Sync + 'static {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
// TODO: impl Deref & DerefMut
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ pub fn read_ansi_from<R: Read + Unpin>(ansi_reader: &mut R, port: InnerViewPort<
|
|||
cursor: Point2::new(0, 0),
|
||||
style: TerminalStyle::default(),
|
||||
invert: false,
|
||||
term_width: 80,
|
||||
term_width: 120,
|
||||
|
||||
cursor_save: Point2::new(0, 0),
|
||||
|
||||
|
@ -159,7 +159,7 @@ impl Perform for PerfAtom {
|
|||
b'\t' => self.horizontal_tab(),
|
||||
0x8 => self.backspace(),
|
||||
_ => {
|
||||
eprintln!("unhandled execute byte {:02x}", byte);
|
||||
//eprintln!("unhandled execute byte {:02x}", byte);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue