From: Max Kellermann Date: Wed, 30 Sep 2009 21:55:40 +0000 (+0200) Subject: screen_play: use mpd_cmd_delete_range() X-Git-Tag: release-0.16~242 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b88961c66aa2c9832eccec6bf81494f483a48955;p=ncmpc.git screen_play: use mpd_cmd_delete_range() --- diff --git a/src/screen_play.c b/src/screen_play.c index 3b50a12..bd830ba 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -663,22 +663,17 @@ play_cmd(struct mpdclient *c, command_t cmd) mpdclient_cmd_play(c, lw->selected); return true; case CMD_DELETE: - { - int i = lw->selected_end, start = lw->selected_start; - for(; i >= start; --i) - mpdclient_cmd_delete(c, i); - - i++; - if(i >= (int)playlist_length(&c->playlist)) - i--; - lw->selected = i; - lw->selected_start = i; - lw->selected_end = i; - lw->range_selection = false; + if (lw->range_selection) { + mpdclient_cmd_delete_range(c, lw->selected_start, + lw->selected_end + 1); + } else { + mpdclient_cmd_delete(c, lw->selected); + } - playlist_save_selection(); + lw->selected = lw->selected_end = lw->selected_start; + lw->range_selection = false; return true; - } + case CMD_SAVE_PLAYLIST: playlist_save(c, NULL, NULL); return true;