fix: send buffer events

This commit is contained in:
əlemi 2022-08-29 02:49:24 +02:00
parent 851781b041
commit 1f32834572

View file

@ -117,10 +117,13 @@ impl Workspace {
let action = rx.recv().await.unwrap(); let action = rx.recv().await.unwrap();
match action { match action {
BufferAction::ADD { buffer } => { BufferAction::ADD { buffer } => {
buffers.insert(buffer.view().name.clone(), buffer); let view = buffer.view();
buffers.insert(view.name.clone(), buffer);
bus.send(Event::BufferNew { path: view.name }).unwrap();
} }
BufferAction::REMOVE { path } => { BufferAction::REMOVE { path } => {
buffers.remove(&path); buffers.remove(&path);
bus.send(Event::BufferDelete { path: path }).unwrap();
} }
} }
tx.send( tx.send(
@ -177,7 +180,7 @@ impl Workspace {
} }
#[derive(Debug)] #[derive(Debug)]
pub enum UserAction { enum UserAction {
ADD { ADD {
user: User, user: User,
}, },
@ -191,7 +194,7 @@ pub enum UserAction {
} }
#[derive(Debug)] #[derive(Debug)]
pub enum BufferAction { enum BufferAction {
ADD { ADD {
buffer: Buffer, buffer: Buffer,
}, },