aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/diff.c6
-rw-r--r--src/nvim/testdir/test_diffmode.vim5
2 files changed, 8 insertions, 3 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 31b7b1bd8f..5f8b81822b 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -982,12 +982,14 @@ static int check_external_diff(diffio_T *diffio)
char_u linebuf[LBUFLEN];
for (;;) {
- // There must be a line that contains "1c1".
+ // For normal diff there must be a line that contains
+ // "1c1". For unified diff "@@ -1 +1 @@".
if (vim_fgets(linebuf, LBUFLEN, fd)) {
break;
}
- if (STRNCMP(linebuf, "1c1", 3) == 0) {
+ if (STRNCMP(linebuf, "1c1", 3) == 0
+ || STRNCMP(linebuf, "@@ -1 +1 @@", 11) == 0) {
ok = kTrue;
}
}
diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim
index 1ade11a8ed..1f7d0e2ea3 100644
--- a/src/nvim/testdir/test_diffmode.vim
+++ b/src/nvim/testdir/test_diffmode.vim
@@ -802,6 +802,7 @@ func VerifyBoth(buf, dumpfile, extra)
" also test unified diff
call term_sendkeys(a:buf, ":call SetupUnified()\<CR>:")
+ call term_sendkeys(a:buf, ":redraw!\<CR>:")
call VerifyScreenDump(a:buf, a:dumpfile, {}, 'unified')
call term_sendkeys(a:buf, ":call StopUnified()\<CR>:")
endfunc
@@ -823,10 +824,11 @@ func Test_diff_screen()
func UnifiedDiffExpr()
" Prepend some text to check diff type detection
call writefile(['warning', ' message'], v:fname_out)
- silent exe '!diff -u ' .. v:fname_in .. ' ' .. v:fname_new .. '>>' .. v:fname_out
+ silent exe '!diff -U0 ' .. v:fname_in .. ' ' .. v:fname_new .. '>>' .. v:fname_out
endfunc
func SetupUnified()
set diffexpr=UnifiedDiffExpr()
+ diffupdate
endfunc
func StopUnified()
set diffexpr=
@@ -1146,4 +1148,5 @@ func Test_diff_and_scroll()
set ls&
endfunc
+
" vim: shiftwidth=2 sts=2 expandtab