To: vim_dev@googlegroups.com Subject: Patch 8.2.2880 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2880 Problem: Unified diff fails if actually used. Solution: Invoke :diffupdate in the test. Fix the check for working external diff. (Ghjuvan Lacambre, Christian Brabandt, closes #8197) Files: src/diff.c, src/testdir/test_diffmode.vim *** ../vim-8.2.2879/src/diff.c 2021-02-10 13:18:14.071747031 +0100 --- src/diff.c 2021-05-18 21:00:11.221363018 +0200 *************** *** 1007,1016 **** for (;;) { ! // There must be a line that contains "1c1". if (vim_fgets(linebuf, LBUFLEN, fd)) break; ! if (STRNCMP(linebuf, "1c1", 3) == 0) ok = TRUE; } fclose(fd); --- 1007,1018 ---- for (;;) { ! // 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 ! || STRNCMP(linebuf, "@@ -1 +1 @@", 11) == 0) ok = TRUE; } fclose(fd); *** ../vim-8.2.2879/src/testdir/test_diffmode.vim 2021-05-18 19:18:58.836868995 +0200 --- src/testdir/test_diffmode.vim 2021-05-24 14:15:37.532816508 +0200 *************** *** 796,801 **** --- 796,802 ---- " also test unified diff call term_sendkeys(a:buf, ":call SetupUnified()\:") + call term_sendkeys(a:buf, ":redraw!\:") call VerifyScreenDump(a:buf, a:dumpfile, {}, 'unified') call term_sendkeys(a:buf, ":call StopUnified()\:") endfunc *************** *** 817,826 **** 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 endfunc func SetupUnified() set diffexpr=UnifiedDiffExpr() endfunc func StopUnified() set diffexpr= --- 818,828 ---- func UnifiedDiffExpr() " Prepend some text to check diff type detection call writefile(['warning', ' message'], 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= *************** *** 1218,1221 **** --- 1220,1224 ---- call delete('Xtest_diff_cuc') endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.2879/src/version.c 2021-05-23 11:18:44.826239726 +0200 --- src/version.c 2021-05-24 14:19:35.695934232 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2880, /**/ -- There are 2 kinds of people in my world: those who know Unix, Perl, Vim, GNU, Linux, etc, and those who know COBOL. It gets very difficult for me at parties, not knowing which group to socialise with :-) Sitaram Chamarty /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///