aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/queue.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/queue.c b/src/queue.c
index 73adb2f49..fc582ec29 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -155,6 +155,20 @@ queue_move(struct queue *queue, unsigned from, unsigned to)
queue->idToPosition[item.id] = to;
queue->items[to] = item;
queue->items[to].version = queue->version;
+
+ /* now deal with order */
+
+ if (queue->random) {
+ for (unsigned i = 0; i < queue->length; i++) {
+ if (queue->order[i] > from && queue->order[i] <= to)
+ queue->order[i]--;
+ else if (queue->order[i] < from &&
+ queue->order[i] >= to)
+ queue->order[i]++;
+ else if (from == queue->order[i])
+ queue->order[i] = to;
+ }
+ }
}
void