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()\<CR>:")
+   call term_sendkeys(a:buf, ":redraw!\<CR>:")
    call VerifyScreenDump(a:buf, a:dumpfile, {}, 'unified')
    call term_sendkeys(a:buf, ":call StopUnified()\<CR>:")
  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 -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202105241221.14OCLbc9182171%40masaka.moolenaar.net.

Raspunde prin e-mail lui