fix separator (#1329)

This commit is contained in:
yetone
2025-02-21 00:53:10 +08:00
committed by GitHub
parent fa89b147db
commit 2d8f25efad

View File

@@ -1788,7 +1788,7 @@ function Sidebar:update_content(content, opts)
opts = vim.tbl_deep_extend("force", { focus = false, scroll = true, stream = false, callback = nil }, opts or {}) opts = vim.tbl_deep_extend("force", { focus = false, scroll = true, stream = false, callback = nil }, opts or {})
if not opts.ignore_history then if not opts.ignore_history then
local chat_history = Path.history.load(self.code.bufnr) local chat_history = Path.history.load(self.code.bufnr)
content = self:render_history_content(chat_history) .. "---\n\n" .. content content = self:render_history_content(chat_history) .. "-------\n\n" .. content
end end
if opts.stream then if opts.stream then
local scroll_to_bottom = function() local scroll_to_bottom = function()
@@ -1915,7 +1915,7 @@ function Sidebar:render_history_content(history)
for idx, entry in ipairs(history) do for idx, entry in ipairs(history) do
if entry.reset_memory then if entry.reset_memory then
content = content .. "***MEMORY RESET***\n\n" content = content .. "***MEMORY RESET***\n\n"
if idx < #history then content = content .. "------\n\n" end if idx < #history then content = content .. "-------\n\n" end
goto continue goto continue
end end
local selected_filepaths = entry.selected_filepaths local selected_filepaths = entry.selected_filepaths
@@ -1932,7 +1932,7 @@ function Sidebar:render_history_content(history)
) )
content = content .. prefix content = content .. prefix
content = content .. entry.response .. "\n\n" content = content .. entry.response .. "\n\n"
if idx < #history then content = content .. "------\n\n" end if idx < #history then content = content .. "-------\n\n" end
::continue:: ::continue::
end end
return content return content
@@ -1945,7 +1945,7 @@ end
---@return string, integer ---@return string, integer
function Sidebar:get_content_between_separators() function Sidebar:get_content_between_separators()
local separator = "------" local separator = "-------"
local cursor_line, _ = Utils.get_cursor_pos() local cursor_line, _ = Utils.get_cursor_pos()
local lines = Utils.get_buf_lines(0, -1, self.result_container.bufnr) local lines = Utils.get_buf_lines(0, -1, self.result_container.bufnr)
local start_line, end_line local start_line, end_line