Skip to content

Commit d6b58bb

Browse files
machrdanilo-leal
andauthored
agent_ui: Use agent font size tokens for thread markdown rendering (#41610)
Release Notes: - N/A --- Previously, agent markdown rendering used hardcoded font sizes (TextSize::Default and TextSize::Small) which ignored the agent_ui_font_size and agent_buffer_font_size settings. This updates the markdown style to respect these settings. This pull request adds support for customizing the font size of code blocks in agent responses, making it possible to set a distinct font size for code within the agent panel. The changes ensure that if the new setting is not specified, the font size will fall back to the agent UI font size, maintaining consistent appearance. (I am a frontend developer without any Rust knowledge so this is co-authored with Claude Code) **Theme settings extension:** * Added a new `agent_buffer_code_font_size` setting to `ThemeSettingsContent`, `ThemeSettings`, and the default settings JSON, allowing users to specify the font size for code blocks in agent responses. [[1]](diffhunk://#diff-a3bba02a485aba48e8e9a9d85485332378aa4fe29a0c50d11ae801ecfa0a56a4R69-R72) [[2]](diffhunk://#diff-aed3a9217587d27844c57ac8aff4a749f1fb1fc5d54926ef5065bf85f8fd633aR118-R119) [[3]](diffhunk://#diff-42e01d7aacb60673842554e30970b4ddbbaee7a2ec2c6f2be1c0b08b0dd89631R82-R83) * Updated the VSCode import logic to recognize and import the new `agent_buffer_code_font_size` setting. **Font size application in agent UI:** * Modified the agent UI rendering logic in `thread_view.rs` to use the new `agent_buffer_code_font_size` for code blocks, and to fall back to the agent UI font size if unset. [[1]](diffhunk://#diff-f73942e8d4f8c4d4d173d57d7c58bb653c4bb6ae7079533ee501750cdca27d98L5584-R5584) [[2]](diffhunk://#diff-f73942e8d4f8c4d4d173d57d7c58bb653c4bb6ae7079533ee501750cdca27d98L5596-R5598) * Implemented a helper method in `ThemeSettings` to retrieve the code block font size, with fallback logic to ensure a value is always used. * Updated the settings application logic to propagate the new code block font size setting throughout the theme system. ### Example Screenshots ![Screenshot 2025-10-31 at 12 38 28](https://github.com/user-attachments/assets/cbc34232-ab1f-40bf-a006-689678380e47) ![Screenshot 2025-10-31 at 12 37 45](https://github.com/user-attachments/assets/372b5cf8-2df8-425a-b052-12136de7c6bd) --------- Co-authored-by: Danilo Leal <[email protected]>
1 parent 03e0581 commit d6b58bb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/agent_ui/src/acp/thread_view.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5596,7 +5596,7 @@ fn default_markdown_style(
55965596
let theme_settings = ThemeSettings::get_global(cx);
55975597
let colors = cx.theme().colors();
55985598

5599-
let buffer_font_size = TextSize::Small.rems(cx);
5599+
let buffer_font_size = theme_settings.agent_buffer_font_size(cx);
56005600

56015601
let mut text_style = window.text_style();
56025602
let line_height = buffer_font_size * 1.75;
@@ -5608,9 +5608,9 @@ fn default_markdown_style(
56085608
};
56095609

56105610
let font_size = if buffer_font {
5611-
TextSize::Small.rems(cx)
5611+
theme_settings.agent_buffer_font_size(cx)
56125612
} else {
5613-
TextSize::Default.rems(cx)
5613+
theme_settings.agent_ui_font_size(cx)
56145614
};
56155615

56165616
let text_color = if muted_text {

0 commit comments

Comments
 (0)