From 42c62206c8f8f915cb2a58b4907fbeec71688300 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Thu, 9 Jul 2020 20:52:06 +0200 Subject: [PATCH] Move the currently playing song to the top when the playlist is manually shuffled Fixes #304 --- src/playlist/playlist.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index 7edbfd409..0fc818ed1 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -1654,6 +1654,11 @@ void Playlist::Shuffle() { PlaylistItemList new_items(items_); int begin = 0; + if (current_item_index_.isValid()) { + if (new_items[0] != new_items[current_item_index_.row()]) + std::swap(new_items[0], new_items[current_item_index_.row()]); + begin = 1; + } const int count = items_.count(); for (int i = begin; i < count; ++i) {