Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/OpenClaw.Tray.WinUI/Chat/ChatComposerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public async Task<bool> SendAsync()
var thread = inputs.CurrentThread;
var draft = _vm.Draft;
var attachments = _vm.PendingAttachments;
var message = draft.Trim();
var message = draft.Trim().Replace("\r\n", "\n").Replace('\r', '\n');
if ((message.Length == 0 && attachments.Count == 0)
|| _vm.SlashDisplay.IsLoading
|| inputs.ConnectionState != "connected")
Expand Down
11 changes: 11 additions & 0 deletions tests/OpenClaw.Tray.Tests/ChatComposerControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ public async Task SendAsync_OrdinaryMessage_CallsProviderExactlyOnceAndClearsDra
Assert.Equal(string.Empty, vm.Draft);
}

[Fact]
public async Task SendAsync_TextBoxLineBreaks_AreSentAsLineFeeds()
{
var (vm, controller, port, _) = MakeController();
vm.SetDraft("line one\rline two\r\nline three");

Assert.True(await controller.SendAsync());

Assert.Equal("line one\nline two\nline three", port.LastSendMessageCall!.Value.Message);
}

[Fact]
public async Task SendAsync_ActiveTurn_AcceptedFollowUpClearsComposerAndAllowsAnotherDraft()
{
Expand Down
Loading