From 695176898e809fe097b5f6ea6db5712cf1cfefe0 Mon Sep 17 00:00:00 2001 From: CharlesChen0823 Date: Wed, 16 Oct 2024 01:41:51 +0800 Subject: [PATCH] project_search: Fix message displayed when no results are found (#19108) when no result found, always display `Search all files`, which is confused. Release Notes: - Fixed an issue where the project search would sometimes show "Search all files" when there were no results. --------- Co-authored-by: Marshall Bowers --- crates/search/src/project_search.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 693d4b265867fb106e8bd994455a12cdb7a82734..1bc49551a714976eca3b82d5ca2a7f58d5f5c200 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -289,7 +289,6 @@ impl ProjectSearch { .await; this.update(&mut cx, |this, cx| { - this.no_results = Some(false); this.match_ranges.extend(match_ranges); cx.notify(); }) @@ -297,6 +296,9 @@ impl ProjectSearch { } this.update(&mut cx, |this, cx| { + if !this.match_ranges.is_empty() { + this.no_results = Some(false); + } this.limit_reached = limit_reached; this.pending_search.take(); cx.notify();