summaryrefslogtreecommitdiffstats
path: root/Meter.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-01-14 11:01:32 +0100
committercgzones <cgzones@googlemail.com>2021-01-15 20:41:10 +0100
commitb5a5e83470ef2db6cace89a5f513b038a96bbff9 (patch)
treecf43635a79afc062e7d54c8b937bf3c73638e644 /Meter.c
parentb9adc30b86ef550655de1e8a8122dae20a6b13df (diff)
LED Meter: display wide characters and restore non-wide ncurses support
Print wide characters, like degree sign, properly via mvadd_wch(). Ignore attributes when returning value from RichString_getCharVal() in non-wide ncurses mode to test against raw characters.
Diffstat (limited to 'Meter.c')
-rw-r--r--Meter.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Meter.c b/Meter.c
index 0fbdcb9d..948ecf64 100644
--- a/Meter.c
+++ b/Meter.c
@@ -414,10 +414,15 @@ static void LEDMeterMode_draw(Meter* this, int x, int y, int w) {
for (int i = 0; i < len; i++) {
int c = RichString_getCharVal(out, i);
if (c >= '0' && c <= '9') {
- LEDMeterMode_drawDigit(xx, y, c - 48);
+ LEDMeterMode_drawDigit(xx, y, c - '0');
xx += 4;
} else {
+#ifdef HAVE_LIBNCURSESW
+ out.chptr[i].attr = 0; /* use LED_COLOR from attrset() */
+ mvadd_wch(yText, xx, &out.chptr[i]);
+#else
mvaddch(yText, xx, c);
+#endif
xx += 1;
}
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy