From 3251e911878b78b0aad8fc09c782f8d81c878f75 Mon Sep 17 00:00:00 2001 From: drkhsh Date: Fri, 28 Oct 2022 00:51:34 +0200 Subject: radical re-formatting 2/3: Fix blocks Fixes coding style. Formatting commits suck, incoherent coding style sucks more. https://suckless.org/coding_style/ --- components/keyboard_indicators.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'components/keyboard_indicators.c') diff --git a/components/keyboard_indicators.c b/components/keyboard_indicators.c index 4a81539..5f62bb7 100644 --- a/components/keyboard_indicators.c +++ b/components/keyboard_indicators.c @@ -33,17 +33,18 @@ keyboard_indicators(const char *fmt) fmtlen = strnlen(fmt, 4); for (i = n = 0; i < fmtlen; i++) { key = tolower(fmt[i]); - if (key != 'c' && key != 'n') { + if (key != 'c' && key != 'n') continue; - } + togglecase = (i + 1 >= fmtlen || fmt[i + 1] != '?'); isset = (state.led_mask & (1 << (key == 'n'))); - if (togglecase) { + + if (togglecase) buf[n++] = isset ? toupper(key) : key; - } else if (isset) { + else if (isset) buf[n++] = fmt[i]; - } } + buf[n] = 0; return buf; } -- cgit v1.2.3