]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
ui: replace non-BMP braille char U+1FB10 with U+28FF
authorMaycon <tiumau@gmail.com>
Fri, 24 Apr 2026 15:22:35 +0000 (12:22 -0300)
committerMaycon <tiumau@gmail.com>
Fri, 24 Apr 2026 15:22:35 +0000 (12:22 -0300)
🮐 (U+1FB10) lives outside the Basic Multilingual Plane and requires
a UTF-16 surrogate pair when wchar_t is 16 bits (Windows, Cygwin).
Passing a surrogate pair to wide-char ncurses functions produces
corrupted output on those platforms.

Replace all three uses with ⣿ (U+28FF), the filled braille pattern,
which is the visually closest BMP character and avoids the issue on
any platform where sizeof(wchar_t) == 2.

ui/curses.c

index 9c0d4580dab65b4aab8909c3bcc0b2f7dd12712b..6355eae6485790741aba6ef6613b8aa176a544f1 100644 (file)
@@ -73,7 +73,7 @@ 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"🮐"
+    L"⣀", L"⣀", L"⣤", L"⣤", L"⣶", L"⣶", L"⣿", L""
 };
 #endif
 
@@ -651,7 +651,7 @@ static const wchar_t *braille_char_lookup(
 
     int i = scale_ms_to_braille_factor(ms);
     if ((unsigned)i >= 4)
-        return L"🮐"; // this is the max
+        return L"⣿"; // max (U+28FF stays in BMP, safe on 16-bit wchar_t)
 
     return braille_set[i];
 }
@@ -693,7 +693,7 @@ static const wchar_t *braille_char_double(
 
     int left_i = scale_ms_to_braille_factor(left_ms);
     if ((unsigned)left_i >= 4)
-        return L"🮐"; // this is the max
+        return L"⣿"; // max (U+28FF stays in BMP, safe on 16-bit wchar_t)
 
     return braille_char_lookup(right_ms, braille_double_lookup[left_i]);
 }