From 0e4ad68e04cd2439bac0e230ecbcce719fb9824f Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Thu, 20 Nov 2025 01:43:03 +0100 Subject: [PATCH] fix(ui): preserve block content formatting when parsing chat messages Remove trimming of block content when parsing chat messages to ensure that formatting, such as leading and trailing whitespace, is preserved. This prevents unintended loss of formatting in code or text blocks within chat sections. --- lua/CopilotChat/ui/chat.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/CopilotChat/ui/chat.lua b/lua/CopilotChat/ui/chat.lua index 0d2e9bc5..45ac51a6 100644 --- a/lua/CopilotChat/ui/chat.lua +++ b/lua/CopilotChat/ui/chat.lua @@ -734,7 +734,7 @@ function Chat:parse() message.content = vim.trim(table.concat(message.content, '\n')) if message.section then for _, block in ipairs(message.section.blocks) do - block.content = vim.trim(table.concat(block.content, '\n')) + block.content = table.concat(block.content, '\n') end end