Allow the agent panel font size to be customized (#29954)

You can set `agent_font_size` as a top-level settings key. You can also
use `zed::IncreaseBufferFontSize` and `zed::DecreaseBufferFontSize` and
`zed::ResetBufferFontSize` the agent panel is focused via the standard
bindings to adjust the agent font size. In the future, it might make
sense to rename these actions to be more general since "buffer" is now a
bit of a misnomer. 🍐'd with @mikayla-maki

Release Notes:

- N/A

---------

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
This commit is contained in:
Nathan Sobo 2025-05-05 16:13:14 -06:00 committed by GitHub
parent 0bf682a0d5
commit 4896e0bc02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 310 additions and 189 deletions

View file

@ -509,13 +509,7 @@ impl MessageEditor {
}))
}
fn render_editor(
&self,
font_size: Rems,
line_height: Pixels,
window: &mut Window,
cx: &mut Context<Self>,
) -> Div {
fn render_editor(&self, window: &mut Window, cx: &mut Context<Self>) -> Div {
let thread = self.thread.read(cx);
let model = thread.configured_model();
@ -621,6 +615,10 @@ impl MessageEditor {
.when(is_editor_expanded, |this| this.h_full())
.child({
let settings = ThemeSettings::get_global(cx);
let font_size = TextSize::Small
.rems(cx)
.to_pixels(settings.agent_font_size(cx));
let line_height = settings.buffer_line_height.value() * font_size;
let text_style = TextStyle {
color: cx.theme().colors().text,
@ -1329,15 +1327,14 @@ impl Render for MessageEditor {
let action_log = self.thread.read(cx).action_log();
let changed_buffers = action_log.read(cx).changed_buffers(cx);
let font_size = TextSize::Small.rems(cx);
let line_height = font_size.to_pixels(window.rem_size()) * 1.5;
let line_height = TextSize::Small.rems(cx).to_pixels(window.rem_size()) * 1.5;
v_flex()
.size_full()
.when(changed_buffers.len() > 0, |parent| {
parent.child(self.render_changed_buffers(&changed_buffers, window, cx))
})
.child(self.render_editor(font_size, line_height, window, cx))
.child(self.render_editor(window, cx))
.children({
let usage_callout = self.render_usage_callout(line_height, cx);