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.
This commit is contained in:
2026-05-17 02:26:03 +02:00
parent 5f7bfb5890
commit 8a18f7caaa
+19 -2
View File
@@ -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);