shithub: riscv

Download patch

ref: c4fdc433ee50b6dc7e50c16a8628093408743323
parent: e2e8551edaa055de4b6b48430d408633725e4c5d
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri Nov 4 13:46:08 EDT 2022

bar: static buffer for splitting, since it is getting used for clicks later on

--- a/sys/src/cmd/bar.c
+++ b/sys/src/cmd/bar.c
@@ -125,7 +125,8 @@
 static void
 redraw(void)
 {
-	char s[1024];
+	static char s[1024];
+	char tmp[1024];
 	Rectangle r;
 	Tmfmt tf;
 	Point p;
@@ -160,10 +161,10 @@
 
 	flushimage(display, 1);
 
-	snprint(s, sizeof(s), "%τ", tf);
-	twidth = MAX(twidth, stringwidth(f, s));
-	snprint(s, sizeof(s), "%|%s%|%s", bats, bats[0] ? "100%" : "", aux, aux);
-	width = twidth + stringwidth(f, s);
+	snprint(tmp, sizeof(tmp), "%τ", tf);
+	twidth = MAX(twidth, stringwidth(f, tmp));
+	snprint(tmp, sizeof(tmp), "%|%s%|%s", bats, bats[0] ? "100%" : "", aux, aux);
+	width = twidth + stringwidth(f, tmp);
 	if(owidth != width)
 		place();
 }