diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index 9e2ed67a9938855863a08f64c5dcfc910e80f7a0..caf25cbec17e038802b0cb19217b36be5b23217c 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -77,7 +77,7 @@ impl View for BufferSearchBar { let editor_container = if self.query_contains_error { theme.search.invalid_editor } else { - theme.search.editor.container + theme.search.editor.input.container }; Flex::row() .with_child( @@ -107,7 +107,7 @@ impl View for BufferSearchBar { .with_style(editor_container) .aligned() .constrained() - .with_max_width(theme.search.max_editor_width) + .with_max_width(theme.search.editor.max_width) .boxed(), ) .with_child( @@ -157,8 +157,9 @@ impl ToolbarItemView for BufferSearchBar { impl BufferSearchBar { pub fn new(cx: &mut ViewContext) -> Self { - let query_editor = - cx.add_view(|cx| Editor::auto_height(2, Some(|theme| theme.search.editor.clone()), cx)); + let query_editor = cx.add_view(|cx| { + Editor::auto_height(2, Some(|theme| theme.search.editor.input.clone()), cx) + }); cx.subscribe(&query_editor, Self::on_query_editor_event) .detach(); diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 2d3bbc5f27be9913c2ce8c9c23b1b4dd47c85a6e..293c33ae6a1b5221af3b0a1427e142738d3ddd57 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -328,7 +328,8 @@ impl ProjectSearchView { .detach(); let query_editor = cx.add_view(|cx| { - let mut editor = Editor::single_line(Some(|theme| theme.search.editor.clone()), cx); + let mut editor = + Editor::single_line(Some(|theme| theme.search.editor.input.clone()), cx); editor.set_text(query_text, cx); editor }); @@ -685,7 +686,7 @@ impl View for ProjectSearchBar { let editor_container = if search.query_contains_error { theme.search.invalid_editor } else { - theme.search.editor.container + theme.search.editor.input.container }; Flex::row() .with_child( @@ -713,7 +714,7 @@ impl View for ProjectSearchBar { .with_style(editor_container) .aligned() .constrained() - .with_max_width(theme.search.max_editor_width) + .with_max_width(theme.search.editor.max_width) .boxed(), ) .with_child( diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 703079523e6277307681d4577efc891ad3a98859..54b85d65c2d3193f757c2dda7ee01ffe5046fad9 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -105,8 +105,7 @@ pub struct Toolbar { pub struct Search { #[serde(flatten)] pub container: ContainerStyle, - pub max_editor_width: f32, - pub editor: FieldEditor, + pub editor: FindEditor, pub invalid_editor: ContainerStyle, pub option_button_group: ContainerStyle, pub option_button: ContainedText, @@ -120,6 +119,13 @@ pub struct Search { pub tab_icon_spacing: f32, } +#[derive(Clone, Deserialize, Default)] +pub struct FindEditor { + #[serde(flatten)] + pub input: FieldEditor, + pub max_width: f32, +} + #[derive(Deserialize, Default)] pub struct Sidebar { #[serde(flatten)] diff --git a/crates/zed/assets/themes/_base.toml b/crates/zed/assets/themes/_base.toml index 06e9c4f3b37ce7794bafd87fcdfa3e43215e0ac7..4f598e6ac6e2a0d116bebf0db6bfd5d7d20b5b35 100644 --- a/crates/zed/assets/themes/_base.toml +++ b/crates/zed/assets/themes/_base.toml @@ -361,7 +361,6 @@ tab_icon_spacing = 4 tab_summary_spacing = 10 [search] -max_editor_width = 250 match_background = "$state.highlighted_line" results_status = { extends = "$text.0", size = 18 } tab_icon_width = 14 @@ -396,6 +395,7 @@ extends = "$text.2" padding = 6 [search.editor] +max_width = 250 background = "$surface.0" corner_radius = 6 padding = { left = 13, right = 13, top = 3, bottom = 3 }