fix(picker.diff): only process --- diffs directly if it doesn't start with a diff header

This commit is contained in:
Folke Lemaitre 2025-10-29 15:22:14 +01:00
parent de352425f7
commit 0a33aec0c6
No known key found for this signature in database
GPG key ID: 9B52594D560070AB

View file

@ -99,10 +99,12 @@ function M.parse(lines)
end
end
local with_diff_header = vim.trim(table.concat(lines, "\n")):find("^diff") ~= nil
for _, text in ipairs(lines) do
if not block and text:find("^%s*$") then
-- Ignore empty lines before a diff block
elseif text:find("^diff") or (text:find("^%-%-%- ") and (not block or hunk)) then
elseif text:find("^diff") or (not with_diff_header and text:find("^%-%-%- ") and (not block or hunk)) then
emit()
local file ---@type string?
if text:find("^diff") then