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.

acp: Keep diff editors in sync with `AgentFontSize` global (#37559)

Cole Miller9d943589713f
diff --git a/crates/agent_ui/src/acp/entry_view_state.rs b/crates/agent_ui/src/acp/entry_view_state.rs
index e60b923ca78..ec57ea7e6df 100644
--- a/crates/agent_ui/src/acp/entry_view_state.rs
+++ b/crates/agent_ui/src/acp/entry_view_state.rs
@@ -207,7 +207,7 @@ impl EntryViewState {
self.entries.drain(range);
}
- pub fn settings_changed(&mut self, cx: &mut App) {
+ pub fn agent_font_size_changed(&mut self, cx: &mut App) {
for entry in self.entries.iter() {
match entry {
Entry::UserMessage { .. } | Entry::AssistantMessage { .. } => {}
diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rs
index 3407f4e878e..b4d56ad05be 100644
--- a/crates/agent_ui/src/acp/thread_view.rs
+++ b/crates/agent_ui/src/acp/thread_view.rs
@@ -43,7 +43,7 @@ use std::{collections::BTreeMap, rc::Rc, time::Duration};
use task::SpawnInTerminal;
use terminal_view::terminal_panel::TerminalPanel;
use text::Anchor;
-use theme::ThemeSettings;
+use theme::{AgentFontSize, ThemeSettings};
use ui::{
Callout, CommonAnimationExt, Disclosure, Divider, DividerColor, ElevationIndex, KeyBinding,
PopoverMenuHandle, Scrollbar, ScrollbarState, SpinnerLabel, TintColor, Tooltip, prelude::*,
@@ -290,7 +290,7 @@ pub struct AcpThreadView {
is_loading_contents: bool,
new_server_version_available: Option<SharedString>,
_cancel_task: Option<Task<()>>,
- _subscriptions: [Subscription; 3],
+ _subscriptions: [Subscription; 4],
}
enum ThreadState {
@@ -380,7 +380,8 @@ impl AcpThreadView {
});
let subscriptions = [
- cx.observe_global_in::<SettingsStore>(window, Self::settings_changed),
+ cx.observe_global_in::<SettingsStore>(window, Self::agent_font_size_changed),
+ cx.observe_global_in::<AgentFontSize>(window, Self::agent_font_size_changed),
cx.subscribe_in(&message_editor, window, Self::handle_message_editor_event),
cx.subscribe_in(&entry_view_state, window, Self::handle_entry_view_event),
];
@@ -4735,9 +4736,9 @@ impl AcpThreadView {
)
}
- fn settings_changed(&mut self, _window: &mut Window, cx: &mut Context<Self>) {
+ fn agent_font_size_changed(&mut self, _window: &mut Window, cx: &mut Context<Self>) {
self.entry_view_state.update(cx, |entry_view_state, cx| {
- entry_view_state.settings_changed(cx);
+ entry_view_state.agent_font_size_changed(cx);
});
}
diff --git a/crates/theme/src/settings.rs b/crates/theme/src/settings.rs
index 11db22d9748..825176a2a0b 100644
--- a/crates/theme/src/settings.rs
+++ b/crates/theme/src/settings.rs
@@ -253,8 +253,9 @@ pub(crate) struct UiFontSize(Pixels);
impl Global for UiFontSize {}
+/// In-memory override for the font size in the agent panel.
#[derive(Default)]
-pub(crate) struct AgentFontSize(Pixels);
+pub struct AgentFontSize(Pixels);
impl Global for AgentFontSize {}