diff --git a/src/browser.cpp b/src/browser.cpp index 0aad556a..1d3b21c3 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -271,6 +271,11 @@ bool Browser::allowsSearching() bool Browser::search(const std::string &constraint) { + if (constraint.empty()) + { + w.clearSearchResults(); + return false; + } try { auto fun = std::bind(BrowserEntryMatcher, _1, _2, false); diff --git a/src/media_library.cpp b/src/media_library.cpp index 50123f81..f7f5998f 100644 --- a/src/media_library.cpp +++ b/src/media_library.cpp @@ -596,6 +596,16 @@ bool MediaLibrary::allowsSearching() bool MediaLibrary::search(const std::string &constraint) { + if (constraint.empty()) + { + if (isActiveWindow(Tags)) + Tags.clearSearchResults(); + else if (isActiveWindow(Albums)) + Albums.clearSearchResults(); + else if (isActiveWindow(Songs)) + Songs.clearSearchResults(); + return false; + } try { bool result = false; diff --git a/src/playlist.cpp b/src/playlist.cpp index 598f6689..3243e9ff 100644 --- a/src/playlist.cpp +++ b/src/playlist.cpp @@ -161,6 +161,11 @@ bool Playlist::allowsSearching() bool Playlist::search(const std::string &constraint) { + if (constraint.empty()) + { + w.clearSearchResults(); + return false; + } try { auto rx = RegexFilter( diff --git a/src/playlist_editor.cpp b/src/playlist_editor.cpp index 980b9db6..66ed4cf4 100644 --- a/src/playlist_editor.cpp +++ b/src/playlist_editor.cpp @@ -364,6 +364,14 @@ bool PlaylistEditor::allowsSearching() bool PlaylistEditor::search(const std::string &constraint) { + if (constraint.empty()) + { + if (isActiveWindow(Playlists)) + Playlists.clearSearchResults(); + else if (isActiveWindow(Content)) + Content.clearSearchResults(); + return false; + } try { bool result = false; diff --git a/src/search_engine.cpp b/src/search_engine.cpp index 28b1c52b..76a486ae 100644 --- a/src/search_engine.cpp +++ b/src/search_engine.cpp @@ -284,6 +284,11 @@ bool SearchEngine::allowsSearching() bool SearchEngine::search(const std::string &constraint) { + if (constraint.empty()) + { + w.clearSearchResults(); + return false; + } try { auto fun = std::bind(SEItemEntryMatcher, _1, _2, false); diff --git a/src/tag_editor.cpp b/src/tag_editor.cpp index 8ae25314..7cb7f9df 100644 --- a/src/tag_editor.cpp +++ b/src/tag_editor.cpp @@ -770,6 +770,14 @@ bool TagEditor::allowsSearching() bool TagEditor::search(const std::string &constraint) { + if (constraint.empty()) + { + if (w == Dirs) + Dirs->clearSearchResults(); + else if (w == Tags) + Tags->clearSearchResults(); + return false; + } try { bool result = false;