queue/PlaylistEdit: fix relative destination offset when moving a range

Commit 13208bf5a7 added range support to
the `move` command, but applied the wrong offset to the `to` variable.
When the source range is before the current song, and the song thus
gets decremented by the range size, then the final destination offset
must also be decremented by the range size.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/663
This commit is contained in:
Max Kellermann 2019-10-15 17:00:16 +02:00
parent 0b9435858b
commit 12a86c4975
2 changed files with 3 additions and 1 deletions

2
NEWS
View File

@ -1,4 +1,6 @@
ver 0.21.16 (not yet released)
* queue
- fix relative destination offset when moving a range
* storage
- curl: request the "resourcetype" property to fix database update
- curl: URL-encode more paths

View File

@ -353,7 +353,7 @@ playlist::MoveRange(PlayerControl &pc, unsigned start, unsigned end, int to)
return;
to = (currentSong + abs(to)) % GetLength();
if (start < (unsigned)to)
to--;
to -= end - start;
}
queue.MoveRange(start, end, to);