From babb114bc463aa153fa96388fd807afa44c3e7d1 Mon Sep 17 00:00:00 2001 From: yetone Date: Fri, 20 Jun 2025 14:26:02 +0800 Subject: [PATCH] fix: swap diff incoming and deleting (#2273) --- lua/avante/llm_tools/replace_in_file.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/avante/llm_tools/replace_in_file.lua b/lua/avante/llm_tools/replace_in_file.lua index 4f9933b..a301380 100644 --- a/lua/avante/llm_tools/replace_in_file.lua +++ b/lua/avante/llm_tools/replace_in_file.lua @@ -589,13 +589,13 @@ function M.func(opts, on_log, on_complete, session_ctx) return { { line_, Highlights.TO_BE_DELETED_WITHOUT_STRIKETHROUGH } } end) :totable() - local extmark_line = math.max(0, start_line - 2) - local delete_extmark_id = vim.api.nvim_buf_set_extmark(bufnr, NAMESPACE, extmark_line, 0, { + -- local extmark_line = math.max(0, start_line - 2) + local end_row = start_line + #diff_block.new_lines - 1 + local delete_extmark_id = vim.api.nvim_buf_set_extmark(bufnr, NAMESPACE, end_row - 1, 0, { virt_lines = deleted_virt_lines, hl_eol = true, hl_mode = "combine", }) - local end_row = start_line + #diff_block.new_lines - 1 local incoming_extmark_id = vim.api.nvim_buf_set_extmark(bufnr, NAMESPACE, start_line - 1, 0, { hl_group = Highlights.INCOMING, hl_eol = true,