diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rs index ae7ab9d2cfb679aab6722f87eea30bf82de6d8e1..714e07e0de93d88b76964be77348d2ee567059ad 100644 --- a/crates/agent_ui/src/agent_panel.rs +++ b/crates/agent_ui/src/agent_panel.rs @@ -2994,8 +2994,7 @@ impl AgentPanel { } // If we had an active buffer, remap its path and reopen it. - let should_zoom_agent_panel = active_file_path.is_none(); - + let had_active_file = active_file_path.is_some(); let remapped_active_path = active_file_path.and_then(|original_path| { let best_match = path_remapping .iter() @@ -3018,7 +3017,7 @@ impl AgentPanel { None }); - if !should_zoom_agent_panel && remapped_active_path.is_none() { + if had_active_file && remapped_active_path.is_none() { log::warn!( "Active file could not be remapped to the new worktree; it will not be reopened" ); @@ -3047,13 +3046,7 @@ impl AgentPanel { // (equivalent to cmd-esc fullscreen behavior). // This must happen after focus_panel, which activates // and opens the panel in the dock. - if should_zoom_agent_panel { - if let Some(panel) = workspace.panel::(cx) { - panel.update(cx, |_panel, cx| { - cx.emit(PanelEvent::ZoomIn); - }); - } - } + if let Some(panel) = workspace.panel::(cx) { panel.update(cx, |panel, cx| { panel.external_thread( @@ -4005,6 +3998,8 @@ impl AgentPanel { let is_text_thread = matches!(&self.active_view, ActiveView::TextThread { .. }); + let is_full_screen = self.is_zoomed(window, cx); + let use_v2_empty_toolbar = has_v2_flag && is_empty_state && !is_in_history_or_config && !is_text_thread; @@ -4049,7 +4044,7 @@ impl AgentPanel { .trigger_with_tooltip(agent_selector_button, { move |_window, cx| { Tooltip::for_action_in( - "New Thread\u{2026}", + "New Thread…", &ToggleNewThreadMenu, &focus_handle, cx, @@ -4093,6 +4088,20 @@ impl AgentPanel { cx, )) }) + .when(is_full_screen, |this| { + this.child( + IconButton::new("disable-full-screen", IconName::Minimize) + .icon_size(IconSize::Small) + .tooltip(move |_, cx| { + Tooltip::for_action("Disable Full Screen", &ToggleZoom, cx) + }) + .on_click({ + cx.listener(move |_, _, window, cx| { + window.dispatch_action(ToggleZoom.boxed_clone(), cx); + }) + }), + ) + }) .child(self.render_panel_options_menu(window, cx)), ) .into_any_element() @@ -4145,6 +4154,20 @@ impl AgentPanel { cx, )) }) + .when(is_full_screen, |this| { + this.child( + IconButton::new("disable-full-screen", IconName::Minimize) + .icon_size(IconSize::Small) + .tooltip(move |_, cx| { + Tooltip::for_action("Disable Full Screen", &ToggleZoom, cx) + }) + .on_click({ + cx.listener(move |_, _, window, cx| { + window.dispatch_action(ToggleZoom.boxed_clone(), cx); + }) + }), + ) + }) .child(self.render_panel_options_menu(window, cx)), ) .into_any_element()