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:
@@ -192,11 +192,28 @@ public sealed class ChatLogWindow : Window
|
|||||||
return;
|
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))
|
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)
|
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);
|
var (info, reason, target) = (args.ChannelSwitchInfo, args.TellReason, args.TellTarget);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user