Skip to content

Commit

Permalink
fix(reset): handle 'endofline' when resetting hunks
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis6991 committed Apr 30, 2024
1 parent 035da03 commit 7aa9a56
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lua/gitsigns/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,13 @@ local function reset_hunk(bufnr, hunk)
lstart = hunk.added.start - 1
lend = hunk.added.start - 1 + hunk.added.count
end

if hunk.removed.no_nl_at_eof ~= hunk.added.no_nl_at_eof then
local no_eol = hunk.added.no_nl_at_eof or false
vim.bo[bufnr].endofline = no_eol
vim.bo[bufnr].fixendofline = no_eol
end

util.set_lines(bufnr, lstart, lend, hunk.removed.lines)
end

Expand Down

0 comments on commit 7aa9a56

Please sign in to comment.