Skip to content

Commit 052f2ff

Browse files
committed
fix(edit_file): consider empty end lines
1 parent 424e8c9 commit 052f2ff

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lua/mcphub/native/neovim/files/edit_file/block_locator.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ end
2828
---@param file_content string Content of the target file
2929
---@return LocatedBlock[] located_blocks Blocks with location information
3030
function BlockLocator:locate_all_blocks(parsed_blocks, file_content)
31-
local file_lines = vim.split(file_content, "\n", { plain = true, trimempty = true })
31+
local file_lines = vim.split(file_content, "\n", { plain = true, trimempty = false })
3232
local located_blocks = {}
3333
for _, parsed_block in ipairs(parsed_blocks) do
3434
if vim.trim(parsed_block.search_content) == "" then

lua/mcphub/native/neovim/files/edit_file/edit_ui.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ function EditUI:_generate_hunk_blocks()
152152
local location_result = located_block.location_result
153153
if location_result.found then
154154
precise_diff_hunks = vim.diff(
155-
table.concat(location_result.found_lines, "\n"),
156-
table.concat(located_block.replace_lines, "\n"),
155+
table.concat(location_result.found_lines, "\n") .. "\n",
156+
table.concat(located_block.replace_lines, "\n") .. "\n",
157157
{ result_type = "indices", algorithm = "histogram", ctxlen = 3 }
158158
) or {} --[[@as table<integer, integer>]]
159159
end

0 commit comments

Comments
 (0)