From 743eef55a5df40d65dfdaf0629f81e2d1a2cf47b Mon Sep 17 00:00:00 2001 From: Jeremy Heng Date: Mon, 6 Apr 2026 21:38:59 +0800 Subject: [PATCH] fix: preserve blank lines in code blocks when submitting messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `on:submit` handlers in Chat.svelte called `.replaceAll('\n\n', '\n')` on the entire message content before passing it to `submitHandler`. This blindly collapsed all double newlines into single newlines, which stripped blank lines inside code blocks — destroying intentional formatting. Removed the `.replaceAll('\n\n', '\n')` from both submit handlers so that message content is passed through unchanged. Fixes #20302 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/lib/components/chat/Chat.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 381d26cd53..17e025736d 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -2951,7 +2951,7 @@ if (e.detail || files.length > 0) { await tick(); - submitHandler(e.detail.replaceAll('\n\n', '\n')); + submitHandler(e.detail); } }} /> @@ -2994,7 +2994,7 @@ clearDraft(); if (e.detail || files.length > 0) { await tick(); - submitHandler(e.detail.replaceAll('\n\n', '\n')); + submitHandler(e.detail); } }} />