Fix #4420: Previous track in dynamic random mix

This commit is contained in:
Juan Luis Boya García 2014-11-29 19:34:31 +01:00
parent 64c34f58ae
commit 292fff7e3a
1 changed files with 18 additions and 15 deletions

View File

@ -657,6 +657,8 @@ void Playlist::set_current_row(int i, bool is_stopping) {
if (dynamic_playlist_ && current_item_index_.isValid()) {
using smart_playlists::Generator;
// When advancing to the next track
if (i > old_current_item_index.row()) {
// Move the new item one position ahead of the last item in the history.
MoveItemWithoutUndo(current_item_index_.row(), dynamic_history_length());
@ -669,11 +671,12 @@ void Playlist::set_current_row(int i, bool is_stopping) {
InsertDynamicItems(count);
}
// Shrink the history, again this is not necessarily by 1, because the user
// might have moved items by hand.
// Shrink the history, again this is not necessarily by 1, because the
// user might have moved items by hand.
const int remove_count =
dynamic_history_length() - dynamic_playlist_->GetDynamicHistory();
if (0 < remove_count) RemoveItemsWithoutUndo(0, remove_count);
}
// the above actions make all commands on the undo stack invalid, so we
// better clear it.