buffer_search: Discard empty search suggestions. (#3136)

Now when buffer_search::Deploy action is triggered (with cmd-f), we'll
keep the previous query in query_editor (if there was one) instead of
replacing it with empty query.

This addresses this bit of feedback from Jose:
> If no text is selected, `cmd + f` should not delete the text in the
search bar when refocusing

Release Notes:
- Improved buffer search by not clearing out query editor when no text
is selected and "buffer search: deploy" (default keybind: cmd-f) is
triggered.
This commit is contained in:
Piotr Osiewicz 2023-10-18 18:05:13 +02:00 committed by GitHub
parent fea6d70d4d
commit 99121ad5cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -537,6 +537,7 @@ impl BufferSearchBar {
self.active_searchable_item
.as_ref()
.map(|searchable_item| searchable_item.query_suggestion(cx))
.filter(|suggestion| !suggestion.is_empty())
}
pub fn set_replacement(&mut self, replacement: Option<&str>, cx: &mut ViewContext<Self>) {