1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-17 12:02:48 +01:00

Don't start a global search if text is empty; start otherwise, even for short queries

(cherry picked from commit 99bcb5c2a2)
This commit is contained in:
Arnaud Bienner 2011-12-05 21:07:22 +01:00 committed by David Sansome
parent 1cda6bd9a8
commit 777caf7757

View File

@ -225,12 +225,6 @@ void GlobalSearchWidget::TextEdited(const QString& text) {
const QString trimmed_text = text.trimmed(); const QString trimmed_text = text.trimmed();
closed_since_search_began_ = false; closed_since_search_began_ = false;
if (trimmed_text.length() < 3) {
RepositionPopup();
last_id_ = -1;
return;
}
// Add results to the back model, switch models after some delay. // Add results to the back model, switch models after some delay.
back_model_->clear(); back_model_->clear();
combine_cache_[back_model_]->Clear(); combine_cache_[back_model_]->Clear();
@ -241,6 +235,11 @@ void GlobalSearchWidget::TextEdited(const QString& text) {
// Cancel the last search (if any) and start the new one. // Cancel the last search (if any) and start the new one.
engine_->CancelSearch(last_id_); engine_->CancelSearch(last_id_);
// If text query is empty, don't start a new search
if (trimmed_text.isEmpty()) {
last_id_ = -1;
return;
}
last_id_ = engine_->SearchAsync(trimmed_text); last_id_ = engine_->SearchAsync(trimmed_text);
} }