summaryrefslogtreecommitdiff
path: root/apps/playlist.c
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2023-11-04 02:44:57 +0100
committerChristian Soffke <christian.soffke@gmail.com>2023-11-11 00:36:14 +0100
commitd4f1247aecbb7129a06052746f8b113e74ebba2e (patch)
tree2ff98de54d2fdf78c341ea7d86aa0a8bb43dcf1b /apps/playlist.c
parente9b4275d1f5b8d166fa772242af44b4d056ed482 (diff)
downloadrockbox-d4f1247aecbb7129a06052746f8b113e74ebba2e.tar.gz
rockbox-d4f1247aecbb7129a06052746f8b113e74ebba2e.zip
Playlists: Fix moving songs in reshuffled playlist
The current index wasn't always correct after moving in a playlist with first index > 0 Change-Id: Ifbcc1e00ed0ec5b26e2176d7971cc5c1e15a8840
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 1f31ec81c1..78d41ea45e 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -2749,6 +2749,11 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index)
2749 else /* Calculate index of desired position */ 2749 else /* Calculate index of desired position */
2750 { 2750 {
2751 new_index = (r+playlist->first_index)%playlist->amount; 2751 new_index = (r+playlist->first_index)%playlist->amount;
2752
2753 if ((new_index < playlist->first_index) && (new_index <= playlist->index))
2754 displace_current = true;
2755 else if ((new_index >= playlist->first_index) && (playlist->index < playlist->first_index))
2756 displace_current = false;
2752 } 2757 }
2753 2758
2754 result = add_track_to_playlist_unlocked(playlist, filename, 2759 result = add_track_to_playlist_unlocked(playlist, filename,