buffer: use icons for search options
This commit is contained in:
parent
2c570fbb72
commit
a7bd05ec0a
1 changed files with 19 additions and 4 deletions
|
@ -163,6 +163,21 @@ impl View for BufferSearchBar {
|
||||||
cx,
|
cx,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
let render_search_option =
|
||||||
|
|options: bool, icon, option, cx: &mut ViewContext<BufferSearchBar>| {
|
||||||
|
options.then(|| {
|
||||||
|
let is_active = self.search_options.contains(option);
|
||||||
|
crate::search_bar::render_option_button_icon::<Self>(
|
||||||
|
is_active,
|
||||||
|
icon,
|
||||||
|
option,
|
||||||
|
move |_, this, cx| {
|
||||||
|
this.toggle_search_option(option, cx);
|
||||||
|
},
|
||||||
|
cx,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
};
|
||||||
Flex::row()
|
Flex::row()
|
||||||
.with_child(
|
.with_child(
|
||||||
Flex::row()
|
Flex::row()
|
||||||
|
@ -210,15 +225,15 @@ impl View for BufferSearchBar {
|
||||||
)
|
)
|
||||||
.with_child(
|
.with_child(
|
||||||
Flex::row()
|
Flex::row()
|
||||||
.with_children(self.render_search_option(
|
.with_children(render_search_option(
|
||||||
supported_options.case,
|
supported_options.case,
|
||||||
"Case",
|
"icons/case_insensitive_12.svg",
|
||||||
SearchOptions::CASE_SENSITIVE,
|
SearchOptions::CASE_SENSITIVE,
|
||||||
cx,
|
cx,
|
||||||
))
|
))
|
||||||
.with_children(self.render_search_option(
|
.with_children(render_search_option(
|
||||||
supported_options.word,
|
supported_options.word,
|
||||||
"Word",
|
"icons/word_search_12.svg",
|
||||||
SearchOptions::WHOLE_WORD,
|
SearchOptions::WHOLE_WORD,
|
||||||
cx,
|
cx,
|
||||||
))
|
))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue