mirror of
https://github.com/neovim/neovim.git
synced 2025-12-10 00:22:41 +00:00
vim-patch:9.1.0740: incorrect internal diff with empty file (#30471)
Problem: incorrect internal diff with an empty file
Solution: Set pointer to NULL, instead of using an empty line file
(Yukihiro Nakadaira)
When using internal diff, empty file is read as one empty line file.
So result differs from external diff.
closes: vim/vim#15719
f1694b439b
Co-authored-by: Yukihiro Nakadaira <yukihiro.nakadaira@gmail.com>
This commit is contained in:
@@ -614,6 +614,34 @@ int main(int argc, char **argv)
|
||||
]])
|
||||
end)
|
||||
|
||||
it('Diff empty and non-empty file', function()
|
||||
write_file(fname, '', false)
|
||||
write_file(fname_2, 'foo\nbar\nbaz', false)
|
||||
reread()
|
||||
|
||||
feed(':set diffopt=filler<cr>')
|
||||
screen:expect([[
|
||||
{7: }{23:------------------}│{7: }{22:foo }|
|
||||
{7: }{23:------------------}│{7: }{22:bar }|
|
||||
{7: }{23:------------------}│{7: }{22:baz }|
|
||||
{7: }^ │{1:~ }|
|
||||
{1:~ }│{1:~ }|*10
|
||||
{3:<onal-diff-screen-1 }{2:<l-diff-screen-1.2 }|
|
||||
:set diffopt=filler |
|
||||
]])
|
||||
|
||||
feed(':set diffopt+=internal<cr>')
|
||||
screen:expect([[
|
||||
{7: }{23:------------------}│{7: }{22:foo }|
|
||||
{7: }{23:------------------}│{7: }{22:bar }|
|
||||
{7: }{23:------------------}│{7: }{22:baz }|
|
||||
{7: }^ │{1:~ }|
|
||||
{1:~ }│{1:~ }|*10
|
||||
{3:<onal-diff-screen-1 }{2:<l-diff-screen-1.2 }|
|
||||
:set diffopt+=internal |
|
||||
]])
|
||||
end)
|
||||
|
||||
it('diffopt+=icase', function()
|
||||
write_file(fname, 'a\nb\ncd\n', false)
|
||||
write_file(fname_2, 'A\nb\ncDe\n', false)
|
||||
|
||||
Reference in New Issue
Block a user