Patch 8.2.1384
Problem:    No ATTENTION prompt for :vimgrep first match file.
Solution:   When there is an existing swap file do not keep the dummy buffer.
            (closes #6649)
Files:      src/quickfix.c, src/testdir/runtest.vim,
            src/testdir/test_quickfix.vim


*** ../vim-8.2.1383/src/quickfix.c      2020-07-23 17:16:15.050100601 +0200
--- src/quickfix.c      2020-08-07 18:10:20.462443925 +0200
***************
*** 6016,6021 ****
--- 6016,6038 ----
  }
  
  /*
+  * Return TRUE if "buf" had an existing swap file, the current swap file does
+  * not end in ".swp".
+  */
+     static int
+ existing_swapfile(buf_T *buf)
+ {
+     if (buf->b_ml.ml_mfp != NULL)
+     {
+       char_u *fname = buf->b_ml.ml_mfp->mf_fname;
+       size_t len = STRLEN(fname);
+ 
+       return fname[len - 1] != 'p' || fname[len - 2] != 'w';
+     }
+     return FALSE;
+ }
+ 
+ /*
   * Search for a pattern in a list of files and populate the quickfix list with
   * the matches.
   */
***************
*** 6125,6131 ****
                        buf = NULL;
                    }
                    else if (buf != *first_match_buf
!                                       || (cmd_args->flags & VGR_NOJUMP))
                    {
                        unload_dummy_buffer(buf, dirname_start);
                        // Keeping the buffer, remove the dummy flag.
--- 6142,6149 ----
                        buf = NULL;
                    }
                    else if (buf != *first_match_buf
!                                       || (cmd_args->flags & VGR_NOJUMP)
!                                       || existing_swapfile(buf))
                    {
                        unload_dummy_buffer(buf, dirname_start);
                        // Keeping the buffer, remove the dummy flag.
*** ../vim-8.2.1383/src/testdir/runtest.vim     2020-07-29 15:02:57.870298502 
+0200
--- src/testdir/runtest.vim     2020-08-07 18:05:56.163240999 +0200
***************
*** 91,96 ****
--- 91,99 ----
  let s:test_script_fname = expand('%')
  au! SwapExists * call HandleSwapExists()
  func HandleSwapExists()
+   if exists('g:ignoreSwapExists')
+     return
+   endif
    " Ignore finding a swap file for the test script (the user might be
    " editing it and do ":make test_name") and the output file.
    " Report finding another swap file and chose 'q' to avoid getting stuck.
*** ../vim-8.2.1383/src/testdir/test_quickfix.vim       2020-07-20 
21:31:01.272823437 +0200
--- src/testdir/test_quickfix.vim       2020-08-07 18:09:00.130686672 +0200
***************
*** 2837,2842 ****
--- 2837,2862 ----
    call delete('Xresult')
  endfunc
  
+ func Test_vimgrep_existing_swapfile()
+   call writefile(['match apple with apple'], 'Xapple')
+   call writefile(['swapfile'], '.Xapple.swp')
+   let g:foundSwap = 0
+   let g:ignoreSwapExists = 1
+   augroup grep
+     au SwapExists * let foundSwap = 1 | let v:swapchoice = 'e'
+   augroup END
+   vimgrep apple Xapple
+   call assert_equal(1, g:foundSwap)
+   call assert_match('.Xapple.swo', swapname(''))
+ 
+   call delete('Xapple')
+   call delete('Xapple.swp')
+   augroup grep
+     au! SwapExists
+   augroup END
+   unlet g:ignoreSwapExists
+ endfunc
+ 
  func XfreeTests(cchar)
    call s:setup_commands(a:cchar)
  
*** ../vim-8.2.1383/src/version.c       2020-08-07 16:49:06.425905234 +0200
--- src/version.c       2020-08-07 18:11:03.862312626 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1384,
  /**/

-- 
I wish there was a knob on the TV to turn up the intelligence.
There's a knob called "brightness", but it doesn't seem to work. 

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            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/202008071612.077GCohE3871666%40masaka.moolenaar.net.

Raspunde prin e-mail lui