shithub: neindaw

Download patch

ref: 2e75e7f6eaa16f526a71bfdef4be4107ca392584
parent: facff7461d4faaa377701d70e146e44890f26b0a
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sun Jan 12 17:11:30 EST 2020

cfg: display units

--- a/cfg/cfg.c
+++ b/cfg/cfg.c
@@ -246,7 +246,8 @@
 			mu_label(tmp);
 			mu_push_id(&c, sizeof(c));
 			v = c->value;
-			if (mu_slider_ex(&v, c->min, c->max, c->step, "%g", MU_OPT_ALIGNCENTER) & MU_RES_CHANGE) {
+			snprint(tmp, sizeof(tmp), "%%g%s", c->unit == nil ? "" : c->unit);
+			if (mu_slider_ex(&v, c->min, c->max, c->step, tmp, MU_OPT_ALIGNCENTER) & MU_RES_CHANGE) {
 				if (fabs(fabs(v) - fabs(c->value)) >= c->step) {
 					n = snprint(tmp, sizeof(tmp), "%g", v);
 					if (write(c->ctl, tmp, n) > 0)