Minor fix

This commit is contained in:
Jonas Widen 2025-03-16 18:19:25 +01:00
parent 554dbab2ed
commit 9981f45c74

View File

@ -175,7 +175,10 @@ local function gemini_query(prompt, context)
for i = #lines, 1, -1 do
if lines[i]:match("^Assistant: Thinking...") then
vim.api.nvim_buf_set_option(chat_bufnr, 'modifiable', true)
vim.api.nvim_buf_set_lines(chat_bufnr, i, i + 1, false, {"Assistant: " .. response})
-- Split response into lines and insert "Assistant: " at the start of first line
local response_lines = vim.split(response, "\n")
response_lines[1] = "Assistant: " .. response_lines[1]
vim.api.nvim_buf_set_lines(chat_bufnr, i, i + 1, false, response_lines)
vim.api.nvim_buf_set_option(chat_bufnr, 'modifiable', false)
break
end