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.

agent_ui: Propagate font size actions from agent panel (#56419)

Ben Brandt17b90b45d3c9
diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rs
index b69287b4c15..065a7859abb 100644
--- a/crates/agent_ui/src/agent_panel.rs
+++ b/crates/agent_ui/src/agent_panel.rs
@@ -2022,7 +2022,13 @@ impl AgentPanel {
theme_settings::adjust_agent_buffer_font_size(cx, |size| size + delta);
}
}
- WhichFontSize::None => {}
+ WhichFontSize::None => {
+ // The agent panel does not own this font size (e.g. when a
+ // terminal is the visible surface). Let the action bubble up
+ // to the workspace handler so the global buffer font size is
+ // adjusted instead.
+ cx.propagate();
+ }
}
}
@@ -2032,14 +2038,23 @@ impl AgentPanel {
_: &mut Window,
cx: &mut Context<Self>,
) {
- if action.persist {
- update_settings_file(self.fs.clone(), cx, move |settings, _| {
- settings.theme.agent_ui_font_size = None;
- settings.theme.agent_buffer_font_size = None;
- });
- } else {
- theme_settings::reset_agent_ui_font_size(cx);
- theme_settings::reset_agent_buffer_font_size(cx);
+ match self.visible_font_size() {
+ WhichFontSize::AgentFont => {
+ if action.persist {
+ update_settings_file(self.fs.clone(), cx, move |settings, _| {
+ settings.theme.agent_ui_font_size = None;
+ settings.theme.agent_buffer_font_size = None;
+ });
+ } else {
+ theme_settings::reset_agent_ui_font_size(cx);
+ theme_settings::reset_agent_buffer_font_size(cx);
+ }
+ }
+ WhichFontSize::None => {
+ // Let the workspace handler reset the global buffer font size
+ // that the terminal uses.
+ cx.propagate();
+ }
}
}