1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Christian Soffke 2023-11-04 02:44:57 +01:00
parent e9b4275d1f
commit d4f1247aec

View file

@ -2749,6 +2749,11 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index)
else /* Calculate index of desired position */ else /* Calculate index of desired position */
{ {
new_index = (r+playlist->first_index)%playlist->amount; new_index = (r+playlist->first_index)%playlist->amount;
if ((new_index < playlist->first_index) && (new_index <= playlist->index))
displace_current = true;
else if ((new_index >= playlist->first_index) && (playlist->index < playlist->first_index))
displace_current = false;
} }
result = add_track_to_playlist_unlocked(playlist, filename, result = add_track_to_playlist_unlocked(playlist, filename,