Rearrange for clarity

This commit is contained in:
Lukas Wirth 2025-08-13 11:56:49 +02:00
parent 036bc75799
commit 88daa45537

View file

@ -201,13 +201,7 @@ impl Render for BufferSearchBar {
let input_base_styles = let input_base_styles =
|border_color| input_base_styles(border_color, |div| div.w(input_width)); |border_color| input_base_styles(border_color, |div| div.w(input_width));
let search_line = h_flex() let query_column = input_base_styles(query_border)
.gap_2()
.when(supported_options.find_in_results, |el| {
el.child(Label::new("Find in results").color(Color::Hint))
})
.child(
input_base_styles(query_border)
.id("editor-scroll") .id("editor-scroll")
.track_scroll(&self.editor_scroll_handle) .track_scroll(&self.editor_scroll_handle)
.child(render_text_input(&self.query_editor, color_override, cx)) .child(render_text_input(&self.query_editor, color_override, cx))
@ -220,11 +214,7 @@ impl Render for BufferSearchBar {
SearchOptions::CASE_SENSITIVE, SearchOptions::CASE_SENSITIVE,
focus_handle.clone(), focus_handle.clone(),
cx.listener(|this, _, window, cx| { cx.listener(|this, _, window, cx| {
this.toggle_case_sensitive( this.toggle_case_sensitive(&ToggleCaseSensitive, window, cx)
&ToggleCaseSensitive,
window,
cx,
)
}), }),
)) ))
}) })
@ -247,10 +237,9 @@ impl Render for BufferSearchBar {
)) ))
}), }),
) )
}), });
)
.child( let mode_column = h_flex()
h_flex()
.gap_1() .gap_1()
.min_w_64() .min_w_64()
.when(supported_options.replacement, |this| { .when(supported_options.replacement, |this| {
@ -293,6 +282,25 @@ impl Render for BufferSearchBar {
) )
}) })
.when(!supported_options.find_in_results, |el| { .when(!supported_options.find_in_results, |el| {
let matches_column = h_flex()
.pl_2()
.ml_1()
.border_l_1()
.border_color(cx.theme().colors().border_variant)
.child(render_nav_button(
ui::IconName::ChevronLeft,
self.active_match_index.is_some(),
"Select Previous Match",
&SelectPreviousMatch,
focus_handle.clone(),
))
.child(render_nav_button(
ui::IconName::ChevronRight,
self.active_match_index.is_some(),
"Select Next Match",
&SelectNextMatch,
focus_handle.clone(),
));
el.child( el.child(
IconButton::new("select-all", ui::IconName::SelectAll) IconButton::new("select-all", ui::IconName::SelectAll)
.on_click(|_, window, cx| { .on_click(|_, window, cx| {
@ -312,27 +320,7 @@ impl Render for BufferSearchBar {
} }
}), }),
) )
.child( .child(matches_column)
h_flex()
.pl_2()
.ml_1()
.border_l_1()
.border_color(cx.theme().colors().border_variant)
.child(render_nav_button(
ui::IconName::ChevronLeft,
self.active_match_index.is_some(),
"Select Previous Match",
&SelectPreviousMatch,
focus_handle.clone(),
))
.child(render_nav_button(
ui::IconName::ChevronRight,
self.active_match_index.is_some(),
"Select Next Match",
&SelectNextMatch,
focus_handle.clone(),
)),
)
.when(!narrow_mode, |this| { .when(!narrow_mode, |this| {
this.child(h_flex().ml_2().min_w(rems_from_px(40.)).child( this.child(h_flex().ml_2().min_w(rems_from_px(40.)).child(
Label::new(match_text).size(LabelSize::Small).color( Label::new(match_text).size(LabelSize::Small).color(
@ -356,8 +344,15 @@ impl Render for BufferSearchBar {
this.dismiss(&Dismiss, window, cx) this.dismiss(&Dismiss, window, cx)
})), })),
) )
}), });
);
let search_line = h_flex()
.gap_2()
.when(supported_options.find_in_results, |el| {
el.child(Label::new("Find in results").color(Color::Hint))
})
.child(query_column)
.child(mode_column);
let replace_line = let replace_line =
should_show_replace_input.then(|| { should_show_replace_input.then(|| {