parent
664da1fcf3
commit
ac922e1785
|
@ -69,8 +69,8 @@ function M.run_diff(fa, fb, diff_algo, indent_heuristic, linematch)
|
|||
run_diff0 = run_diff_xdl
|
||||
end
|
||||
|
||||
local a = vim.tbl_isempty(fa) and '' or table.concat(fa, '\n')
|
||||
local b = vim.tbl_isempty(fb) and '' or table.concat(fb, '\n')
|
||||
local a = table.concat(fa, '\n')
|
||||
local b = table.concat(fb, '\n')
|
||||
|
||||
local results = run_diff0(a, b, diff_algo, indent_heuristic, linematch)
|
||||
|
||||
|
|
|
@ -49,13 +49,19 @@ function M.buf_lines(bufnr)
|
|||
-- nvim_buf_get_lines strips carriage returns if fileformat==dos
|
||||
local buftext = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
||||
|
||||
if vim.bo[bufnr].fileformat == 'dos' then
|
||||
for i = 1, #buftext do
|
||||
local dos = vim.bo[bufnr].fileformat == 'dos'
|
||||
|
||||
if dos then
|
||||
for i = 1, #buftext - 1 do
|
||||
buftext[i] = buftext[i] .. '\r'
|
||||
end
|
||||
end
|
||||
|
||||
if vim.bo[bufnr].endofline then
|
||||
-- Add CR to the last line
|
||||
if dos then
|
||||
buftext[#buftext] = buftext[#buftext] .. '\r'
|
||||
end
|
||||
buftext[#buftext + 1] = ''
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue