summaryrefslogtreecommitdiff
path: root/src/diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/diff.c')
-rw-r--r--src/diff.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/diff.c b/src/diff.c
index ceb73a6bd..9fb8726b4 100644
--- a/src/diff.c
+++ b/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;
}