fix now playing update if playlist is filtered

This commit is contained in:
Andrzej Rybczak
2009-03-15 13:35:18 +01:00
parent 31ab01cc1c
commit 1e511d1d8d
2 changed files with 13 additions and 14 deletions

View File

@@ -458,17 +458,20 @@ int main(int argc, char *argv[])
{
Playlist::BlockNowPlayingUpdate = 1;
myPlaylist->Main()->SetTimeout(50);
int del_counter = 0;
while (!myPlaylist->Main()->Empty() && Keypressed(input, Key.Delete))
{
size_t id = myPlaylist->Main()->Choice();
TraceMpdStatus();
myPlaylist->UpdateTimer();
if (myPlaylist->NowPlaying > myPlaylist->CurrentSong()->GetPosition()) // needed for keeping proper
myPlaylist->NowPlaying--; // position of now playing song.
// needed for keeping proper position of now playing song.
if (myPlaylist->NowPlaying > myPlaylist->CurrentSong()->GetPosition()-del_counter)
myPlaylist->NowPlaying--;
Mpd->DeleteID(myPlaylist->CurrentSong()->GetID());
myPlaylist->Main()->DeleteOption(id);
myPlaylist->Main()->Refresh();
myPlaylist->Main()->ReadKey(input);
del_counter++;
}
myPlaylist->FixPositions(myPlaylist->Main()->Choice());
myPlaylist->Main()->SetTimeout(ncmpcpp_window_timeout);