From be881369fafce53fd43cdcf2e67f4b9966db37d4 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Tue, 11 Jul 2023 12:12:37 -0700 Subject: [PATCH 1/2] Fix a bug where the terminal panel's items wouldn't be hooked up properly to workspace actions --- crates/terminal_view/src/terminal_panel.rs | 10 ++++++++++ crates/terminal_view/src/terminal_view.rs | 2 +- crates/workspace/src/item.rs | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs index 11f8f7abde..2670226e26 100644 --- a/crates/terminal_view/src/terminal_panel.rs +++ b/crates/terminal_view/src/terminal_panel.rs @@ -221,6 +221,16 @@ 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) + }) + } + }, + _ => {} } } diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs index c40a1a7ccd..d1219d53e0 100644 --- a/crates/terminal_view/src/terminal_view.rs +++ b/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(); } diff --git a/crates/workspace/src/item.rs b/crates/workspace/src/item.rs index a3e3ab9299..0c7a478e31 100644 --- a/crates/workspace/src/item.rs +++ b/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, From 550aa2d6bdc71123b6352355a42055ad265906fd Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Tue, 11 Jul 2023 12:17:50 -0700 Subject: [PATCH 2/2] fmt --- crates/terminal_view/src/terminal_panel.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs index 2670226e26..ad61903a9d 100644 --- a/crates/terminal_view/src/terminal_panel.rs +++ b/crates/terminal_view/src/terminal_panel.rs @@ -225,11 +225,9 @@ impl TerminalPanel { 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) - }) + workspace.update(cx, |workspace, cx| item.added_to_pane(workspace, pane, cx)) } - }, + } _ => {} }