From c3346f2274f731e1c9aaeab39849026e34d34143 Mon Sep 17 00:00:00 2001 From: Jonas Widen Date: Sun, 16 Mar 2025 19:24:58 +0100 Subject: [PATCH] Restore chat history --- lua/gemini/chat.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lua/gemini/chat.lua b/lua/gemini/chat.lua index e803871..b13b51f 100644 --- a/lua/gemini/chat.lua +++ b/lua/gemini/chat.lua @@ -111,13 +111,16 @@ function M.create_window() end end -function M.update_content(content, is_new_chat) +function M.update_content(content, is_new_chat, is_thinking) vim.api.nvim_buf_set_option(state.bufnr, 'modifiable', true) local lines = vim.split(content, "\n") - if #state.conversation_history > 1 then -- Check if there's more than one message - -- Add separator before new content + -- Only add separator if: + -- 1. Not the first message + -- 2. Not a thinking message + -- 3. There's existing content in the buffer + if not is_thinking and not is_new_chat and vim.api.nvim_buf_line_count(state.bufnr) > 0 then local separator = "━━━━━━━━━━━━━━━━━━━━━━━━━━" table.insert(lines, 1, separator) end