mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
fix(picker.diff): only process --- diffs directly if it doesn't start with a diff header
This commit is contained in:
parent
de352425f7
commit
0a33aec0c6
1 changed files with 3 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue