Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

terminal_view: Fix focusing of center-pane terminals (#37359)

Moritz von Göwels7327ef662b00
diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs
index 848737aeb24..2ba7f617bf4 100644
--- a/crates/terminal_view/src/terminal_panel.rs
+++ b/crates/terminal_view/src/terminal_panel.rs
@@ -41,7 +41,7 @@ use workspace::{
ui::IconName,
};
-use anyhow::{Context as _, Result, anyhow};
+use anyhow::{Result, anyhow};
use zed_actions::assistant::InlineAssist;
const TERMINAL_PANEL_KEY: &str = "TerminalPanel";
@@ -905,11 +905,16 @@ impl TerminalPanel {
RevealStrategy::Always => match reveal_target {
RevealTarget::Center => {
task_workspace.update_in(cx, |workspace, window, cx| {
- workspace
- .active_item(cx)
- .context("retrieving active terminal item in the workspace")?
- .item_focus_handle(cx)
- .focus(window);
+ let did_activate = workspace.activate_item(
+ &terminal_to_replace,
+ true,
+ true,
+ window,
+ cx,
+ );
+
+ anyhow::ensure!(did_activate, "Failed to retrieve terminal pane");
+
anyhow::Ok(())
})??;
}