Do not display match count when query is empty
This commit is contained in:
parent
b282bdfe5a
commit
a583d1c6cc
1 changed files with 25 additions and 19 deletions
|
@ -178,20 +178,13 @@ impl View for BufferSearchBar {
|
|||
)
|
||||
})
|
||||
};
|
||||
Flex::row()
|
||||
.with_child(
|
||||
Flex::column()
|
||||
.with_child(
|
||||
Flex::row()
|
||||
.align_children_center()
|
||||
.with_child(
|
||||
Flex::row()
|
||||
.with_child(self.render_nav_button("<", Direction::Prev, cx))
|
||||
.with_child(self.render_nav_button(">", Direction::Next, cx))
|
||||
.aligned(),
|
||||
)
|
||||
.with_children(self.active_searchable_item.as_ref().and_then(
|
||||
|searchable_item| {
|
||||
let match_count = self
|
||||
.active_searchable_item
|
||||
.as_ref()
|
||||
.and_then(|searchable_item| {
|
||||
if self.query(cx).is_empty() {
|
||||
return None;
|
||||
}
|
||||
let matches = self
|
||||
.searchable_items_with_matches
|
||||
.get(&searchable_item.downgrade())?;
|
||||
|
@ -207,8 +200,20 @@ impl View for BufferSearchBar {
|
|||
.with_style(theme.search.match_index.container)
|
||||
.aligned(),
|
||||
)
|
||||
},
|
||||
))
|
||||
});
|
||||
Flex::row()
|
||||
.with_child(
|
||||
Flex::column()
|
||||
.with_child(
|
||||
Flex::row()
|
||||
.align_children_center()
|
||||
.with_child(
|
||||
Flex::row()
|
||||
.with_child(self.render_nav_button("<", Direction::Prev, cx))
|
||||
.with_child(self.render_nav_button(">", Direction::Next, cx))
|
||||
.aligned(),
|
||||
)
|
||||
.with_children(match_count)
|
||||
.aligned()
|
||||
.left()
|
||||
.top()
|
||||
|
@ -765,6 +770,7 @@ impl BufferSearchBar {
|
|||
self.active_match_index.take();
|
||||
active_searchable_item.clear_matches(cx);
|
||||
let _ = done_tx.send(());
|
||||
cx.notify();
|
||||
} else {
|
||||
let query = if self.current_mode == SearchMode::Regex {
|
||||
match SearchQuery::regex(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue