Add line height settings for the editor

This commit is contained in:
Mikayla Maki
2023-07-13 16:14:33 -07:00
parent b7ed467690
commit 77c4fc98bd
5 changed files with 46 additions and 4 deletions
+4 -1
View File
@@ -494,6 +494,7 @@ pub enum SoftWrap {
#[derive(Clone)]
pub struct EditorStyle {
pub text: TextStyle,
pub line_height_scalar: f32,
pub placeholder_text: Option<TextStyle>,
pub theme: theme::Editor,
pub theme_id: usize,
@@ -8101,7 +8102,7 @@ fn build_style(
cx: &AppContext,
) -> EditorStyle {
let font_cache = cx.font_cache();
let line_height_scalar = settings.line_height();
let theme_id = settings.theme.meta.id;
let mut theme = settings.theme.editor.clone();
let mut style = if let Some(get_field_editor_theme) = get_field_editor_theme {
@@ -8115,6 +8116,7 @@ fn build_style(
EditorStyle {
text: field_editor_theme.text,
placeholder_text: field_editor_theme.placeholder_text,
line_height_scalar,
theme,
theme_id,
}
@@ -8137,6 +8139,7 @@ fn build_style(
underline: Default::default(),
},
placeholder_text: None,
line_height_scalar,
theme,
theme_id,
}
+1 -1
View File
@@ -1975,7 +1975,7 @@ impl Element<Editor> for EditorElement {
let snapshot = editor.snapshot(cx);
let style = self.style.clone();
let line_height = style.text.line_height(cx.font_cache());
let line_height = (style.text.font_size * style.line_height_scalar).round();
let gutter_padding;
let gutter_width;