Revert deletion of FindEditor in theme

This commit is contained in:
Antonio Scandurra 2022-03-30 13:35:17 +02:00
parent 94097a56a1
commit 621e67bca7
4 changed files with 18 additions and 10 deletions

View file

@ -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>) -> 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();

View file

@ -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(

View file

@ -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)]

View file

@ -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 }