diff options
author | Sigrid Solveig Haflínudóttir <sigrid@ftrv.se> | 2022-11-04 17:46:08 +0000 |
---|---|---|
committer | Sigrid Solveig Haflínudóttir <sigrid@ftrv.se> | 2022-11-04 17:46:08 +0000 |
commit | c4fdc433ee50b6dc7e50c16a8628093408743323 (patch) | |
tree | 76e1fb0eec2e0c6c113780740d3455999808088f /sys/src/cmd/bar.c | |
parent | e2e8551edaa055de4b6b48430d408633725e4c5d (diff) |
bar: static buffer for splitting, since it is getting used for clicks later on
Diffstat (limited to 'sys/src/cmd/bar.c')
-rw-r--r-- | sys/src/cmd/bar.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/src/cmd/bar.c b/sys/src/cmd/bar.c index fcfde808c..e62b076c8 100644 --- a/sys/src/cmd/bar.c +++ b/sys/src/cmd/bar.c @@ -125,7 +125,8 @@ split(char *s) static void redraw(void) { - char s[1024]; + static char s[1024]; + char tmp[1024]; Rectangle r; Tmfmt tf; Point p; @@ -160,10 +161,10 @@ redraw(void) 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(); } |