From: Max Kellermann Date: Sun, 18 Oct 2009 00:21:13 +0000 (+0200) Subject: screen_queue: move ranges with one single "move" command X-Git-Tag: release-0.16~82 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f2869e0068b0bd8710ece1e0088db0cb5507bcac;p=ncmpc.git screen_queue: move ranges with one single "move" command Instead of swapping every single song in the selected range, send one single "move" command which moves the neighbor song to the other end of the range. --- diff --git a/NEWS b/NEWS index 7b12cbe..4e7906d 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,7 @@ ncmpc 0.16 - not yet released * strfsong: support multiple values for a tag * screen_browser: different colors for directories and playlists * screen_browser: display song duration +* screen_queue: move ranges with one single "move" command ncmpc 0.15 - 2009-09-24 diff --git a/src/screen_queue.c b/src/screen_queue.c index 7d915eb..02978ea 100644 --- a/src/screen_queue.c +++ b/src/screen_queue.c @@ -785,8 +785,8 @@ screen_queue_cmd(struct mpdclient *c, command_t cmd) if (range.start == 0 || range.end <= range.start) return false; - for (unsigned i = range.start; i < range.end; ++i) - mpdclient_cmd_swap(c, i, i - 1); + if (!mpdclient_cmd_move(c, range.end - 1, range.start - 1)) + return true; lw->selected--; lw->range_base--; @@ -799,8 +799,8 @@ screen_queue_cmd(struct mpdclient *c, command_t cmd) if (range.end >= playlist_length(&c->playlist)) return false; - for (int i = range.end - 1; i >= (int)range.start; --i) - mpdclient_cmd_swap(c, i, i + 1); + if (!mpdclient_cmd_move(c, range.start, range.end)) + return true; lw->selected++; lw->range_base++;