0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.3925: diff mode confused by NUL bytes

Problem:    Diff mode confused by NUL bytes.
Solution:   Handle NUL bytes differently. (Christian Brabandt, closes #9421,
            closes #9418)
This commit is contained in:
Bram Moolenaar
2021-12-28 18:30:05 +00:00
parent 7473a84cf9
commit 06f6095623
7 changed files with 131 additions and 4 deletions

View File

@@ -777,9 +777,14 @@ diff_write_buffer(buf_T *buf, diffin_T *din)
int orig_len;
char_u cbuf[MB_MAXBYTES + 1];
// xdiff doesn't support ignoring case, fold-case the text.
c = PTR2CHAR(s);
c = MB_CASEFOLD(c);
if (*s == NL)
c = NUL;
else
{
// xdiff doesn't support ignoring case, fold-case the text.
c = PTR2CHAR(s);
c = MB_CASEFOLD(c);
}
orig_len = mb_ptr2len(s);
if (mb_char2bytes(c, cbuf) != orig_len)
// TODO: handle byte length difference
@@ -791,7 +796,10 @@ diff_write_buffer(buf_T *buf, diffin_T *din)
len += orig_len;
}
else
ptr[len++] = *s++;
{
ptr[len++] = *s == NL ? NUL : *s;
s++;
}
}
ptr[len++] = NL;
}