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

Release Notes:

- agent: Fixed `cmd-+` and `cmd--` not affecting the font size of diffs.
This commit is contained in:
Cole Miller
2025-09-04 18:33:56 +00:00
committed by GitHub
parent 9e11105483
commit 9d94358971
3 changed files with 9 additions and 7 deletions
+1 -1
View File
@@ -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 { .. } => {}
+6 -5
View File
@@ -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);
});
}
+2 -1
View File
@@ -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 {}