From 4ae7415503321771dff88af6b76cf4c88a5f9fc0 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sun, 8 Mar 2009 19:03:53 +0000 Subject: [PATCH] Fix insert/queue next, last and replace to update the last insert position too, giving well defined behavior and useful interaction with insert, and making things like insert next followed by many inserts work. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20247 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/playlist.c b/apps/playlist.c index acbadf982c..d426900a2b 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -720,14 +720,15 @@ static int add_track_to_playlist(struct playlist_info* playlist, else position = insert_position = 0; - if (playlist->last_insert_pos < 0 && playlist->started) - playlist->last_insert_pos = position; + playlist->last_insert_pos = position; break; case PLAYLIST_INSERT_LAST: if (playlist->first_index > 0) position = insert_position = playlist->first_index; else position = insert_position = playlist->amount; + + playlist->last_insert_pos = position; break; case PLAYLIST_INSERT_SHUFFLED: { @@ -756,7 +757,7 @@ static int add_track_to_playlist(struct playlist_info* playlist, if (playlist_remove_all_tracks(playlist) < 0) return -1; - position = insert_position = playlist->index + 1; + playlist->last_insert_pos = position = insert_position = playlist->index + 1; break; }