Fix a bug where the terminal would not be closed by the terminal exiting (#2706)

Mikayla Maki created

Release Notes:

- Fixed a bug where terminal tabs in the panel would not close on tty
process exit.

Change summary

crates/terminal_view/src/terminal_panel.rs | 8 ++++++++
crates/terminal_view/src/terminal_view.rs  | 2 +-
crates/workspace/src/item.rs               | 2 +-
3 files changed, 10 insertions(+), 2 deletions(-)

Detailed changes

crates/terminal_view/src/terminal_panel.rs 🔗

@@ -221,6 +221,14 @@ impl TerminalPanel {
             pane::Event::ZoomIn => cx.emit(Event::ZoomIn),
             pane::Event::ZoomOut => cx.emit(Event::ZoomOut),
             pane::Event::Focus => cx.emit(Event::Focus),
+
+            pane::Event::AddItem { item } => {
+                if let Some(workspace) = self.workspace.upgrade(cx) {
+                    let pane = self.pane.clone();
+                    workspace.update(cx, |workspace, cx| item.added_to_pane(workspace, pane, cx))
+                }
+            }
+
             _ => {}
         }
     }

crates/terminal_view/src/terminal_view.rs 🔗

@@ -275,7 +275,7 @@ impl TerminalView {
         cx.spawn(|this, mut cx| async move {
             Timer::after(CURSOR_BLINK_INTERVAL).await;
             this.update(&mut cx, |this, cx| this.resume_cursor_blinking(epoch, cx))
-                .log_err();
+                .ok();
         })
         .detach();
     }

crates/workspace/src/item.rs 🔗

@@ -27,7 +27,7 @@ use std::{
 };
 use theme::Theme;
 
-#[derive(Eq, PartialEq, Hash)]
+#[derive(Eq, PartialEq, Hash, Debug)]
 pub enum ItemEvent {
     CloseItem,
     UpdateTab,