From 5391d2cb1cfe8eefd04b1749d44a912f2bdc5c12 Mon Sep 17 00:00:00 2001 From: HueByte Date: Tue, 24 Feb 2026 21:44:43 +0100 Subject: [PATCH] fix: improve role tag formatting and handle empty role cases in user status display --- src/EchoHub.Client/UI/Chat/ChatColors.cs | 4 ++++ src/EchoHub.Client/UI/MainWindow.cs | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/EchoHub.Client/UI/Chat/ChatColors.cs b/src/EchoHub.Client/UI/Chat/ChatColors.cs index f6fc1ec..0eee5a6 100644 --- a/src/EchoHub.Client/UI/Chat/ChatColors.cs +++ b/src/EchoHub.Client/UI/Chat/ChatColors.cs @@ -39,6 +39,10 @@ public static partial class ChatColors lastIndex = match.Index + match.Length; } + // Add remaining text after the last mention (or all text if no mentions found) + if (lastIndex < text.Length) + segments.Add(new ChatSegment(text[lastIndex..], defaultColor)); + // Second pass: highlight #channels in non-mention segments var mentionSegments = segments; segments = []; diff --git a/src/EchoHub.Client/UI/MainWindow.cs b/src/EchoHub.Client/UI/MainWindow.cs index 9905312..f46e5cc 100644 --- a/src/EchoHub.Client/UI/MainWindow.cs +++ b/src/EchoHub.Client/UI/MainWindow.cs @@ -923,12 +923,14 @@ public sealed partial class MainWindow : Runnable var name = u.DisplayName ?? u.Username; var roleTag = u.Role switch { - ServerRole.Owner => "\u2605 ", // ★ - ServerRole.Admin => "\u2666 ", // ♦ - ServerRole.Mod => "\u2740 ", // ❀ + ServerRole.Owner => "\u2605", // ★ + ServerRole.Admin => "\u2666", // ♦ + ServerRole.Mod => "\u2740", // ❀ _ => "" }; - var text = $"{statusIcon} {roleTag} {name}"; + var text = roleTag.Length > 0 + ? $"{statusIcon} {roleTag} {name}" + : $"{statusIcon} {name}"; var nameColor = HexColorHelper.ParseHexColor(u.NicknameColor); return (text, nameColor, u.Username); }).ToList();