git: 9front

Download patch

ref: 368f2dfaca7e2b9992d3ce79062aee9d8ff393b1
parent: f9edb2df5b0ad529d68d2f78a7d10f245d9d9d61
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Sep 21 15:04:18 EDT 2022

audio/zuke: fix playlist plumbing while in shuffled mode

--- a/sys/src/cmd/audio/zuke/zuke.c
+++ b/sys/src/cmd/audio/zuke/zuke.c
@@ -1099,7 +1099,7 @@
 static void
 plumbaudio(void *kbd)
 {
-	int i, f, pf, mcw[Ncol], wasplaying;
+	int i, f, pf, mcw[Ncol], playing, shuffled;
 	Playlist *p;
 	Plumbmsg *m;
 	char *s, *e;
@@ -1123,7 +1123,9 @@
 				close(pf);
 				if(p == nil)
 					continue;
-				wasplaying = pcurplaying;
+				playing = pcurplaying;
+				if(shuffled = (shuffle != nil))
+					sendul(kbd, 's');
 				/* make sure nothing is playing */
 				while(pcurplaying >= 0){
 					sendul(kbd, 'v');
@@ -1134,7 +1136,12 @@
 				memmove(mincolwidth, mcw, sizeof(mincolwidth));
 				adjustcolumns();
 				pcur = 0;
-				if(wasplaying >= 0)
+				if(shuffled){
+					pcur = nrand(pl->n);
+					sendul(kbd, 's');
+				}
+				redraw(1);
+				if(playing >= 0)
 					sendul(kbd, '\n');
 			}else{
 				for(i = 0; i < pl->n; i++){
--