From 4e1bb68620f746a4683af4c335acdd207775a017 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Mon, 16 Sep 2024 08:28:27 -0400 Subject: [PATCH] Use buffer font for the inline assistant (#17875) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes https://github.com/zed-industries/zed/issues/17738 This PR is motivated by having also noticed what the issue above mentions. Looked it further and it does seem the inline assistant had a slightly bigger font-size even though it was using the configured UI font-size as per https://github.com/zed-industries/zed/pull/17542. I'm not sure why that was, technically speaking. However, I ended up realizing that, given we're within the editor, it'd make more sense to use the buffer font instead. With this change, the size mismatch seems to be gone. Screenshot 2024-09-16 at 2 13 28 PM Release Notes: - N/A --- crates/assistant/src/inline_assistant.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/assistant/src/inline_assistant.rs b/crates/assistant/src/inline_assistant.rs index 8b71e54746dad6d0d5478a16d89f86dd62777288..30a5c98a54372a44a6a4ced58b9b65df09663ea6 100644 --- a/crates/assistant/src/inline_assistant.rs +++ b/crates/assistant/src/inline_assistant.rs @@ -1465,7 +1465,7 @@ impl Render for PromptEditor { .border_y_1() .border_color(cx.theme().status().info_border) .size_full() - .py(cx.line_height() / 2.) + .py(cx.line_height() / 2.5) .on_action(cx.listener(Self::confirm)) .on_action(cx.listener(Self::cancel)) .on_action(cx.listener(Self::move_up)) @@ -1918,12 +1918,11 @@ impl PromptEditor { } else { cx.theme().colors().text }, - font_family: settings.ui_font.family.clone(), - font_features: settings.ui_font.features.clone(), - font_fallbacks: settings.ui_font.fallbacks.clone(), - font_size: settings.ui_font_size.into(), - font_weight: settings.ui_font.weight, - line_height: relative(1.3), + font_family: settings.buffer_font.family.clone(), + font_fallbacks: settings.buffer_font.fallbacks.clone(), + font_size: settings.buffer_font_size.into(), + font_weight: settings.buffer_font.weight, + line_height: relative(settings.buffer_line_height.value()), ..Default::default() }; EditorElement::new(