diff --git a/lua/avante/sidebar.lua b/lua/avante/sidebar.lua index 525f848..1d22efe 100644 --- a/lua/avante/sidebar.lua +++ b/lua/avante/sidebar.lua @@ -224,8 +224,9 @@ local function transform_result_content(selected_files, result_content, prev_fil local start_line = 0 local end_line = 0 local match_filetype = nil + local filepath = current_filepath or prev_filepath or "" for _, file in ipairs(selected_files) do - if not Utils.is_same_file(file.path, prev_filepath or "") then goto continue1 end + if not Utils.is_same_file(file.path, filepath) then goto continue1 end local file_content = vim.split(file.content, "\n") if start_line ~= 0 or end_line ~= 0 then break end for j = 1, #file_content - (search_end - search_start) + 1 do diff --git a/lua/avante/templates/planning.avanterules b/lua/avante/templates/planning.avanterules index 8de118f..9e76666 100644 --- a/lua/avante/templates/planning.avanterules +++ b/lua/avante/templates/planning.avanterules @@ -116,6 +116,7 @@ Every *SEARCH/REPLACE block* must use this format: 5. The start of replace block: 6. The lines to replace into the source code 7. The end of the replace block: +8. Please *DO NOT* put *SEARCH/REPLACE block* inside three backticks: {%raw%}```{%endraw%} Use the *FULL* file path, as shown to you by the user.