Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(reset_buffer): do not insert extra newline #863

Merged
merged 1 commit into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions lua/gitsigns/diffthis.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ local bufread = async.void(function(bufnr, dbufnr, base)
error(err, 2)
end
async.scheduler_if_buf_valid(bufnr)
if vim.bo[bufnr].fileformat == 'dos' then
text = util.strip_cr(text)
end
end

local modifiable = vim.bo[dbufnr].modifiable
Expand Down
8 changes: 5 additions & 3 deletions lua/gitsigns/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ end
--- @param lines string[]
function M.set_lines(bufnr, start_row, end_row, lines)
if vim.bo[bufnr].fileformat == 'dos' then
for i = 1, #lines do
lines[i] = lines[i]:gsub('\r$', '')
end
lines = M.strip_cr(lines)
end
if start_row == 0 and end_row == -1 and lines[#lines] == '' then
lines = vim.deepcopy(lines)
lines[#lines] = nil
end
vim.api.nvim_buf_set_lines(bufnr, start_row, end_row, false, lines)
end
Expand Down
Loading