From a7c5b8d78b636afb639cccef80561cec7b5c68cd Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Fri, 24 Oct 2025 15:11:39 -0300 Subject: [PATCH] Add `ResetAllZoom` and `ResetAgentZoom ` actions (#41124) Very often, when I'm testing or playing around with the zoom feature, including the agent panel, I find myself missing one quick action that would bring everything back to normal. That's what `ResetAllZoom` does. If you have customized your zoom level in all areas of Zed, that action returns everything to its default state. Similarly, if you're playing around with zoom just in the agent panel, `ResetAgentZoom` does the same in that context. Release Notes: - Added the `ResetAllZoom` and `ResetAgentZoom ` actions, allowing to return the zoom level across the whole app and/or just in the agent panel to its default/original value. --- crates/agent_ui/src/agent_panel.rs | 16 +++++++++++++++- crates/zed/src/zed.rs | 18 ++++++++++++++++++ crates/zed/src/zed/app_menus.rs | 4 ++++ crates/zed_actions/src/lib.rs | 11 +++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rs index afce4d31c7a424276f7ad382bad480eac0595be8..997a2bec09aa2a0ae39909c909c7de80771c5055 100644 --- a/crates/agent_ui/src/agent_panel.rs +++ b/crates/agent_ui/src/agent_panel.rs @@ -72,7 +72,9 @@ use workspace::{ }; use zed_actions::{ DecreaseBufferFontSize, IncreaseBufferFontSize, ResetBufferFontSize, - agent::{OpenAcpOnboardingModal, OpenOnboardingModal, OpenSettings, ResetOnboarding}, + agent::{ + OpenAcpOnboardingModal, OpenOnboardingModal, OpenSettings, ResetAgentZoom, ResetOnboarding, + }, assistant::{OpenRulesLibrary, ToggleFocus}, }; @@ -193,6 +195,13 @@ pub fn init(cx: &mut App) { }) .register_action(|_workspace, _: &ResetTrialEndUpsell, _window, cx| { TrialEndUpsell::set_dismissed(false, cx); + }) + .register_action(|workspace, _: &ResetAgentZoom, window, cx| { + if let Some(panel) = workspace.panel::(cx) { + panel.update(cx, |panel, cx| { + panel.reset_agent_zoom(window, cx); + }); + } }); }, ) @@ -1102,6 +1111,11 @@ impl AgentPanel { } } + pub fn reset_agent_zoom(&mut self, _window: &mut Window, cx: &mut Context) { + theme::reset_agent_ui_font_size(cx); + theme::reset_agent_buffer_font_size(cx); + } + pub fn toggle_zoom(&mut self, _: &ToggleZoom, window: &mut Window, cx: &mut Context) { if self.zoomed { cx.emit(PanelEvent::ZoomOut); diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 972b34b17cc7ae7f7dfee4ab3792eeb49aeba52b..12a1bc8d50b2916658877165c2eedef9c8ce235c 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -870,6 +870,24 @@ fn register_actions( } } }) + .register_action({ + let fs = app_state.fs.clone(); + move |_, action: &zed_actions::ResetAllZoom, _window, cx| { + if action.persist { + update_settings_file(fs.clone(), cx, move |settings, _| { + settings.theme.ui_font_size = None; + settings.theme.buffer_font_size = None; + settings.theme.agent_ui_font_size = None; + settings.theme.agent_buffer_font_size = None; + }); + } else { + theme::reset_ui_font_size(cx); + theme::reset_buffer_font_size(cx); + theme::reset_agent_ui_font_size(cx); + theme::reset_agent_buffer_font_size(cx); + } + } + }) .register_action(|_, _: &install_cli::RegisterZedScheme, window, cx| { cx.spawn_in(window, async move |workspace, cx| { install_cli::register_zed_scheme(cx).await?; diff --git a/crates/zed/src/zed/app_menus.rs b/crates/zed/src/zed/app_menus.rs index 2baf4f708c29a7bec11e8aa26a1897a20a75e3c9..ac22f972368f61fa518ac74a5ac23e593433c75b 100644 --- a/crates/zed/src/zed/app_menus.rs +++ b/crates/zed/src/zed/app_menus.rs @@ -20,6 +20,10 @@ pub fn app_menus(cx: &mut App) -> Vec { "Reset Zoom", zed_actions::ResetBufferFontSize { persist: false }, ), + MenuItem::action( + "Reset All Zoom", + zed_actions::ResetAllZoom { persist: false }, + ), MenuItem::separator(), MenuItem::action("Toggle Left Dock", workspace::ToggleLeftDock), MenuItem::action("Toggle Right Dock", workspace::ToggleRightDock), diff --git a/crates/zed_actions/src/lib.rs b/crates/zed_actions/src/lib.rs index b246ed9c471f22195b1089a4916df77303ddee1f..3fc9903cdc99a8bf5fdb7c14619e3ce963b8fc46 100644 --- a/crates/zed_actions/src/lib.rs +++ b/crates/zed_actions/src/lib.rs @@ -154,6 +154,15 @@ pub struct ResetUiFontSize { pub persist: bool, } +/// Resets all zoom levels (UI and buffer font sizes, including in the agent panel) to their default values. +#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)] +#[action(namespace = zed)] +#[serde(deny_unknown_fields)] +pub struct ResetAllZoom { + #[serde(default)] + pub persist: bool, +} + pub mod dev { use gpui::actions; @@ -311,6 +320,8 @@ pub mod agent { /// Add the current selection as context for threads in the agent panel. #[action(deprecated_aliases = ["assistant::QuoteSelection", "agent::QuoteSelection"])] AddSelectionToThread, + /// Resets the agent panel zoom levels (agent UI and buffer font sizes). + ResetAgentZoom, ] ); }