ap

An audio player suited to my tastes
Log | Files | Refs | README | LICENSE

commit 6bdd8be6af27c8d7ee3ad8e20c9f7fa9239cea1e
parent 335cf5562928434589900fd148a958196d69016b
Author: Jacob R. Edwards <n/a>
Date:   Thu, 14 Apr 2022 01:30:19 -0500

By default, leave the current item in truncate command

It's not uncommon to want to remove everything except the current
item. The remove command can still be used to delete everything
from the queue.

Diffstat:
Maps/command.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/aps/command.c b/aps/command.c @@ -248,12 +248,15 @@ com_player(struct aps *aps, int fd, int argc, char **argv) return NULL; } - char * com_truncate(struct aps *aps, int fd, int argc, char **argv) { - while (aps->queue) - queue_remove(aps, aps->queue); + while (aps->queue && aps->queue->next != aps->queue) + queue_remove(aps, aps->queue->next); + + if (!argc) + return NULL; + queue_remove(aps, aps->queue); return com_add(aps, fd, argc, argv); }