diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index 8a29aaba..a7ae81d8 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -1703,6 +1703,7 @@ int main(int argc, char *argv[]) { if (!mPlaylist->Empty() && current_screen == csPlaylist) { + block_playlist_update = 1; if (mPlaylist->IsAnySelected()) { vector list; @@ -1717,15 +1718,17 @@ int main(int argc, char *argv[]) } else { - block_playlist_update = 1; dont_change_now_playing = 1; mPlaylist->SetTimeout(50); while (!mPlaylist->Empty() && Keypressed(input, Key.Delete)) { + int id = mPlaylist->GetChoice(); TraceMpdStatus(); timer = time(NULL); - Mpd->QueueDeleteSong(mPlaylist->GetChoice()); - mPlaylist->DeleteOption(mPlaylist->GetChoice()); + if (now_playing > id) // needed for keeping proper + now_playing--; // position of now playing song. + Mpd->QueueDeleteSong(id); + mPlaylist->DeleteOption(id); mPlaylist->Refresh(); mPlaylist->ReadKey(input); } @@ -1872,7 +1875,7 @@ int main(int argc, char *argv[]) if (*it == now_playing && list.front() > 0) mPlaylist->BoldOption(now_playing, 0); - vectororigs(list); + vector origs(list); while (Keypressed(input, Key.MvSongUp) && list.front() > 0) { @@ -1892,6 +1895,9 @@ int main(int argc, char *argv[]) { int from, to; from = to = mPlaylist->GetChoice(); + // unbold now playing as if song changes during move, this won't be unbolded. + if (to == now_playing && to > 0) + mPlaylist->BoldOption(now_playing, 0); while (Keypressed(input, Key.MvSongUp) && to > 0) { TraceMpdStatus(); @@ -1913,7 +1919,7 @@ int main(int argc, char *argv[]) vector list; mPlaylistEditor->GetSelectedList(list); - vectororigs(list); + vector origs(list); while (Keypressed(input, Key.MvSongUp) && list.front() > 0) { @@ -1964,7 +1970,7 @@ int main(int argc, char *argv[]) if (*it == now_playing && list.back() < mPlaylist->Size()-1) mPlaylist->BoldOption(now_playing, 0); - vectororigs(list); + vector origs(list); while (Keypressed(input, Key.MvSongDown) && list.back() < mPlaylist->Size()-1) { @@ -1984,6 +1990,9 @@ int main(int argc, char *argv[]) { int from, to; from = to = mPlaylist->GetChoice(); + // unbold now playing as if song changes during move, this won't be unbolded. + if (to == now_playing && to < mPlaylist->Size()-1) + mPlaylist->BoldOption(now_playing, 0); while (Keypressed(input, Key.MvSongDown) && to < mPlaylist->Size()-1) { TraceMpdStatus(); @@ -2006,7 +2015,7 @@ int main(int argc, char *argv[]) vector list; mPlaylistEditor->GetSelectedList(list); - vectororigs(list); + vector origs(list); while (Keypressed(input, Key.MvSongDown) && list.back() < mPlaylistEditor->Size()-1) { diff --git a/src/status_checker.cpp b/src/status_checker.cpp index c21194b8..39f514fc 100644 --- a/src/status_checker.cpp +++ b/src/status_checker.cpp @@ -285,20 +285,18 @@ void NcmpcppStatusChanged(MPDConnection *Mpd, MPDStatusChanges changed, void *da { if (!mPlaylist->Empty() && now_playing >= 0) { - if (!mPlaylist->Empty()) + if (Config.repeat_one_mode && repeat_one_allowed) { - if (Config.repeat_one_mode && repeat_one_allowed) - { - std::swap(now_playing, old_playing); - Mpd->Play(now_playing); - } - if (old_playing >= 0) - mPlaylist->BoldOption(old_playing, 0); - mPlaylist->BoldOption(now_playing, 1); - if (Config.autocenter_mode) - mPlaylist->Highlight(now_playing); - repeat_one_allowed = 0; + std::swap(now_playing, old_playing); + Mpd->Play(now_playing); } + if (old_playing >= 0) + mPlaylist->BoldOption(old_playing, 0); + mPlaylist->BoldOption(now_playing, 1); + if (Config.autocenter_mode) + mPlaylist->Highlight(now_playing); + repeat_one_allowed = 0; + if (!Mpd->GetElapsedTime()) mvwhline(wFooter->RawWin(), 0, 0, 0, wFooter->GetWidth()); }