From: Bart Trojanowski Date: Wed, 9 Apr 2025 20:45:45 +0000 (-0400) Subject: fix legend for braille display X-Git-Tag: v0.96~5^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f72fe93202cab89e19d15aa0f40c7056d38cd9b0;p=thirdparty%2Fmtr.git fix legend for braille display --- diff --git a/ui/curses.c b/ui/curses.c index ab5e92e..9c0d458 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -71,6 +71,11 @@ enum { NUM_FACTORS = 8 }; static double factors[NUM_FACTORS]; static int scale[NUM_FACTORS]; static char block_map[NUM_FACTORS]; +#ifdef WITH_BRAILLE_DISPLAY +static const wchar_t *braille_map[NUM_FACTORS] = { + L"⣀", L"⣀", L"⣤", L"⣤", L"⣶", L"⣶", L"⣿", L"🮐" +}; +#endif enum { black = 1, red, green, yellow, blue, magenta, cyan, white }; static const int block_col[NUM_FACTORS + 1] = { @@ -952,17 +957,23 @@ void mtr_curses_redraw( printw("Scale:"); attroff(A_BOLD); - for (i = 0; i < NUM_FACTORS - 1; i++) { +#ifdef WITH_BRAILLE_DISPLAY + bool use_braille_map = (ctl->display_mode == DisplayModeBraille); +#endif + + for (i = 0; i < NUM_FACTORS; i++) { printw(" "); attrset(block_col[i + 1]); - printw("%c", block_map[i]); +#ifdef WITH_BRAILLE_DISPLAY + if (use_braille_map) + printw("%ls", braille_map[i]); + else +#endif + printw("%c", block_map[i]); attrset(A_NORMAL); - printw(":%d ms", scale[i] / 1000); + if (i < NUM_FACTORS-1) + printw(":%d ms", scale[i] / 1000); } - printw(" "); - attrset(block_col[NUM_FACTORS]); - printw("%c", block_map[NUM_FACTORS - 1]); - attrset(A_NORMAL); } refresh();