From f9e59f02136d84e76f7644dde6aad5a94331388f Mon Sep 17 00:00:00 2001
From: "gcp-cherry-pick-bot[bot]"
<98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com>
Date: Wed, 24 Apr 2024 17:54:12 -0400
Subject: [PATCH] Restore the previous styles for single-line editors
(cherry-pick #10951) (#10952)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cherry-picked Restore the previous styles for single-line editors
(#10951)
This PR fixes a bug introduced in #10870 that caused editors used as
single-line inputs to have the wrong text style.
If this change was intentional for something relating to the new
Assistant panel, we'll need to figure out a way to change it without
breaking these other usages.
### Before
### After
Release Notes:
- Fixed a bug where some inputs were using the wrong font style
(preview-only).
Co-authored-by: Marshall Bowers
---
crates/editor/src/editor.rs | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index cfca895eff8ec93c32a3a3838c2f7321a02f75ad..a2fc4d67cfbc0ff967367038154ffa03f4bc46c7 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -10323,7 +10323,19 @@ impl Render for Editor {
let settings = ThemeSettings::get_global(cx);
let text_style = match self.mode {
- EditorMode::SingleLine | EditorMode::AutoHeight { .. } => cx.text_style(),
+ EditorMode::SingleLine | EditorMode::AutoHeight { .. } => TextStyle {
+ color: cx.theme().colors().editor_foreground,
+ font_family: settings.ui_font.family.clone(),
+ font_features: settings.ui_font.features,
+ font_size: rems(0.875).into(),
+ font_weight: FontWeight::NORMAL,
+ font_style: FontStyle::Normal,
+ line_height: relative(settings.buffer_line_height.value()),
+ background_color: None,
+ underline: None,
+ strikethrough: None,
+ white_space: WhiteSpace::Normal,
+ },
EditorMode::Full => TextStyle {
color: cx.theme().colors().editor_foreground,
font_family: settings.buffer_font.family.clone(),