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:
16
src/diff.c
16
src/diff.c
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user