From 8a18f7caaae571febc52b2ddfab272ac84349d65 Mon Sep 17 00:00:00 2001 From: Jon Kazama Date: Sun, 17 May 2026 02:26:03 +0200 Subject: [PATCH] fix(chat-input): replace input on slash-command insert Cherry-pick from ChatTwo upstream ee7768ac (Infiziert90, 2026-05-16): when args.AddIfNotPresent or args.Input starts with '/', replace the chat input instead of appending. Fixes the Friend-List "/tell" path where existing text like "test" would otherwise concatenate to "test/tell user@world" before the receiver and channel resolve. Variable drift versus upstream: HellionChat uses local 'Chat' where ChatTwo uses InputHandler.ChatInput; logic is 1:1. --- HellionChat/Ui/ChatLogWindow.cs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/HellionChat/Ui/ChatLogWindow.cs b/HellionChat/Ui/ChatLogWindow.cs index ca990aa..a884336 100644 --- a/HellionChat/Ui/ChatLogWindow.cs +++ b/HellionChat/Ui/ChatLogWindow.cs @@ -192,11 +192,28 @@ public sealed class ChatLogWindow : Window return; } + // --------------------------------------------------------------- + // Cherry-picked from ChatTwo upstream ee7768ac (Infiziert90, 2026-05-16) + // - Replace the chat input when args.AddIfNotPresent / args.Input starts + // with a slash. Vanilla actions like the Friend List "/tell" entry and + // other plugins push slash commands through these args; appending them + // to existing text would produce inputs like "test/tell user@world". + // --------------------------------------------------------------- if (args.AddIfNotPresent != null && !Chat.Contains(args.AddIfNotPresent)) - Chat += args.AddIfNotPresent; + { + if (args.AddIfNotPresent.StartsWith('/')) + Chat = args.AddIfNotPresent; + else + Chat += args.AddIfNotPresent; + } if (args.Input != null) - Chat += args.Input; + { + if (args.Input.StartsWith('/')) + Chat = args.Input; + else + Chat += args.Input; + } var (info, reason, target) = (args.ChannelSwitchInfo, args.TellReason, args.TellTarget);