From c8be98c0eb6bed22c4a531c4fdb56b33f71adb64 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Tue, 10 Feb 2009 14:09:32 +0100 Subject: [PATCH] can shuffle selected list --- src/screen_play.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/screen_play.c b/src/screen_play.c index 665a986..eb26893 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -598,6 +598,21 @@ play_cmd(mpdclient_t *c, command_t cmd) center_playing_item(c); playlist_repaint(); return false; + case CMD_SHUFFLE: + { + unsigned i = lw->selected_start + 1; + unsigned last_selected = lw->selected; + if(!lw->visual_selection) + /* No visual selection, shuffle all list. */ + break; + for(; i <= lw->selected_end; ++i) + mpdclient_cmd_move(c, i, lw->selected_start + (rand() % ((i - lw->selected_start) + 1))); + + lw->selected = last_selected; + screen_status_printf(_("Shuffled selection!")); + + return true; + } case CMD_LIST_MOVE_UP: if(lw->selected_start == 0) return false; -- 2.30.2