fix: respect the minimize_diff configuration (#2267)
This commit is contained in:
@@ -263,12 +263,17 @@ function M.func(opts, on_log, on_complete, session_ctx)
|
|||||||
end
|
end
|
||||||
local old_string = table.concat(old_lines, "\n")
|
local old_string = table.concat(old_lines, "\n")
|
||||||
local new_string = table.concat(new_lines, "\n")
|
local new_string = table.concat(new_lines, "\n")
|
||||||
|
local patch
|
||||||
|
if Config.behaviour.minimize_diff then
|
||||||
---@diagnostic disable-next-line: assign-type-mismatch, missing-fields
|
---@diagnostic disable-next-line: assign-type-mismatch, missing-fields
|
||||||
local patch = vim.diff(old_string, new_string, { ---@type integer[][]
|
patch = vim.diff(old_string, new_string, { ---@type integer[][]
|
||||||
algorithm = "histogram",
|
algorithm = "histogram",
|
||||||
result_type = "indices",
|
result_type = "indices",
|
||||||
ctxlen = vim.o.scrolloff,
|
ctxlen = vim.o.scrolloff,
|
||||||
})
|
})
|
||||||
|
else
|
||||||
|
patch = { { 1, #old_lines, 1, #new_lines } }
|
||||||
|
end
|
||||||
local diff_blocks_ = {}
|
local diff_blocks_ = {}
|
||||||
for _, hunk in ipairs(patch) do
|
for _, hunk in ipairs(patch) do
|
||||||
local start_a, count_a, start_b, count_b = unpack(hunk)
|
local start_a, count_a, start_b, count_b = unpack(hunk)
|
||||||
|
|||||||
Reference in New Issue
Block a user