Skip to content

Commit 7aa9a56

Browse files
committed
fix(reset): handle 'endofline' when resetting hunks
1 parent 035da03 commit 7aa9a56

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lua/gitsigns/actions.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,13 @@ local function reset_hunk(bufnr, hunk)
318318
lstart = hunk.added.start - 1
319319
lend = hunk.added.start - 1 + hunk.added.count
320320
end
321+
322+
if hunk.removed.no_nl_at_eof ~= hunk.added.no_nl_at_eof then
323+
local no_eol = hunk.added.no_nl_at_eof or false
324+
vim.bo[bufnr].endofline = no_eol
325+
vim.bo[bufnr].fixendofline = no_eol
326+
end
327+
321328
util.set_lines(bufnr, lstart, lend, hunk.removed.lines)
322329
end
323330

0 commit comments

Comments
 (0)