Skip to content

Commit c8ab202

Browse files
petobenscleong14
authored andcommitted
fix(prompt_library): don't trim empty lines with user role content (olimorris#1211)
Don't trim empty lines when user role and empty content
1 parent db9f475 commit c8ab202

File tree

1 file changed

+2
-1
lines changed
  • lua/codecompanion/strategies/chat

1 file changed

+2
-1
lines changed

lua/codecompanion/strategies/chat/ui.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ function UI:render(context, messages, opts)
248248
self:set_header(lines, set_llm_role(self.roles.llm, self.adapter))
249249
end
250250

251-
for _, text in ipairs(vim.split(msg.content, "\n", { plain = true, trimempty = true })) do
251+
local trimempty = not (msg.role == "user" and msg.content == "")
252+
for _, text in ipairs(vim.split(msg.content, "\n", { plain = true, trimempty = trimempty })) do
252253
table.insert(lines, text)
253254
end
254255

0 commit comments

Comments
 (0)