diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-09-23 12:04:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-23 12:04:07 +0800 |
commit | bfe0acaea167a5ce18d4c63f65ccd45966203413 (patch) | |
tree | a53ce3e5b327e8b65b8892b73648016bd13ae989 /src/nvim/diff.c | |
parent | e83ce331da9165ad611b31aef9965fa74abaea14 (diff) | |
download | rneovim-bfe0acaea167a5ce18d4c63f65ccd45966203413.tar.gz rneovim-bfe0acaea167a5ce18d4c63f65ccd45966203413.tar.bz2 rneovim-bfe0acaea167a5ce18d4c63f65ccd45966203413.zip |
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
https://github.com/vim/vim/commit/f1694b439bb175d956b49da620f1253462ec507b
Co-authored-by: Yukihiro Nakadaira <yukihiro.nakadaira@gmail.com>
Diffstat (limited to 'src/nvim/diff.c')
-rw-r--r-- | src/nvim/diff.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 7096c5fa8a..0c59b8eb67 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -736,6 +736,12 @@ static void clear_diffout(diffout_T *dout) /// @return FAIL for failure. static int diff_write_buffer(buf_T *buf, mmfile_t *m, linenr_T start, linenr_T end) { + if (buf->b_ml.ml_flags & ML_EMPTY) { + m->ptr = NULL; + m->size = 0; + return OK; + } + size_t len = 0; if (end < 0) { |