From 743290cf0a87561b4275ca684bdf5d88bf804413 Mon Sep 17 00:00:00 2001 From: Hugh Wang Date: Sun, 5 Mar 2017 22:49:19 +0800 Subject: [PATCH] Improve detection for songs not in playlists --- src/screens/playlist_editor.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/screens/playlist_editor.cpp b/src/screens/playlist_editor.cpp index b8e4168d..5c6f2dd3 100644 --- a/src/screens/playlist_editor.cpp +++ b/src/screens/playlist_editor.cpp @@ -529,7 +529,7 @@ void PlaylistEditor::locateSong(const MPD::Song &s) for (auto pl_it = current_successor; pl_it != end; ++pl_it) if (locate_and_switch_playlist(pl_it)) return; - for (auto pl_it = begin; pl_it != current_successor; ++pl_it) + for (auto pl_it = begin; pl_it != Playlists.currentV(); ++pl_it) if (locate_and_switch_playlist(pl_it)) return; } @@ -545,19 +545,9 @@ void PlaylistEditor::locateSong(const MPD::Song &s) } } - // Wrap back to the beginning of current playlist - if (Content.size() != 0) - { - auto song_it = std::find(Content.beginV(), Content.currentV(), s); - if (song_it != Content.currentV()) - { - Content.highlight(song_it - Content.beginV()); - nextColumn(); - return; - } - } - - Statusbar::print("Song is not from playlists"); + // If the currently highlighted song is what we are looking for, don't show error + if (Content.currentV() == Content.endV() || *Content.currentV() != s) + Statusbar::print("Song is not from playlists"); } namespace {