Patch 8.1.0259
Problem:    No test for fixed quickfix issue.
Solution:   Add a test.  Clean up the code a bit. (Yegappan Lakshmanan)
Files:      src/quickfix.c, src/testdir/test_quickfix.vim


*** ../vim-8.1.0258/src/quickfix.c      2018-08-07 21:54:27.725813349 +0200
--- src/quickfix.c      2018-08-09 21:14:43.248703692 +0200
***************
*** 1506,1512 ****
      return qi->qf_lists[qf_idx].qf_count <= 0;
  }
  
- 
  /*
   * Allocate the fields used for parsing lines and populating a quickfix list.
   */
--- 1506,1511 ----
***************
*** 3717,3723 ****
      if (IS_LL_WINDOW(curwin))
        qi = GET_LOC_LIST(curwin);
  
!     if (qi == NULL || qi->qf_lists[qi->qf_curlist].qf_count == 0)
      {
        EMSG(_(e_quickfix));
        return;
--- 3716,3722 ----
      if (IS_LL_WINDOW(curwin))
        qi = GET_LOC_LIST(curwin);
  
!     if (qf_list_empty(qi, qi->qf_curlist))
      {
        EMSG(_(e_quickfix));
        return;
***************
*** 4349,4355 ****
      if (qi->qf_lists[qi->qf_curlist].qf_id != save_qfid)
        qi->qf_curlist = qf_id2nr(qi, save_qfid);
  
!     if (qi->qf_lists[qi->qf_curlist].qf_count > 0)
        qf_jump(qi, 0, 0, forceit);
  }
  
--- 4348,4355 ----
      if (qi->qf_lists[qi->qf_curlist].qf_id != save_qfid)
        qi->qf_curlist = qf_id2nr(qi, save_qfid);
  
!     // Autocommands might have cleared the list, check for it
!     if (!qf_list_empty(qi, qi->qf_curlist))
        qf_jump(qi, 0, 0, forceit);
  }
  
***************
*** 4873,4882 ****
      // free the list.
      if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile)
            && qflist_valid(wp, save_qfid))
-     {
        // display the first error
        qf_jump_first(qi, save_qfid, eap->forceit);
-     }
  }
  
  /*
--- 4873,4880 ----
***************
*** 6581,6590 ****
            if (res > 0 && (eap->cmdidx == CMD_cbuffer ||
                                                eap->cmdidx == CMD_lbuffer)
                    && qflist_valid(wp, save_qfid))
-           {
                // display the first error
                qf_jump_first(qi, save_qfid, eap->forceit);
-           }
        }
      }
  }
--- 6579,6586 ----
***************
*** 6661,6670 ****
            if (res > 0 && (eap->cmdidx == CMD_cexpr
                                                   || eap->cmdidx == CMD_lexpr)
                    && qflist_valid(wp, save_qfid))
-           {
                // display the first error
                qf_jump_first(qi, save_qfid, eap->forceit);
-           }
        }
        else
            EMSG(_("E777: String or List expected"));
--- 6657,6664 ----
*** ../vim-8.1.0258/src/testdir/test_quickfix.vim       2018-07-25 
22:36:48.991518559 +0200
--- src/testdir/test_quickfix.vim       2018-08-09 21:14:43.248703692 +0200
***************
*** 3478,3483 ****
--- 3478,3507 ----
    call assert_equal(5, line('.'))
    autocmd! QuickFixCmdPost
  
+   " Test for autocommands clearing the quickfix list before jumping to the
+   " first error. This should not result in an error
+   autocmd QuickFixCmdPost * call g:Xsetlist([], 'r')
+   let v:errmsg = ''
+   " Test for cfile/lfile
+   Xfile Xerr
+   call assert_true(v:errmsg !~# 'E42:')
+   " Test for cbuffer/lbuffer
+   edit Xerr
+   Xbuffer
+   call assert_true(v:errmsg !~# 'E42:')
+   " Test for cexpr/lexpr
+   Xexpr 'Xtestfile2:4:Line4'
+   call assert_true(v:errmsg !~# 'E42:')
+   " Test for grep/lgrep
+   " The grepprg may not be set on non-Unix systems
+   if has('unix')
+     silent Xgrep Line5 Xtestfile2
+     call assert_true(v:errmsg !~# 'E42:')
+   endif
+   " Test for vimgrep/lvimgrep
+   call assert_fails('silent Xvimgrep Line5 Xtestfile2', 'E480:')
+   autocmd! QuickFixCmdPost
+ 
    call delete('Xerr')
    call delete('Xtestfile1')
    call delete('Xtestfile2')
*** ../vim-8.1.0258/src/version.c       2018-08-08 22:55:38.034420872 +0200
--- src/version.c       2018-08-09 21:17:42.991183590 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     259,
  /**/

-- 
BROTHER MAYNARD: Armaments Chapter Two Verses Nine to Twenty One.
ANOTHER MONK:    And St.  Attila raised his hand grenade up on high saying "O
                 Lord bless this thy hand grenade that with it thou mayest
                 blow thine enemies to tiny bits, in thy mercy. "and the Lord
                 did grin and people did feast upon the lambs and sloths and
                 carp and anchovies and orang-utans and breakfast cereals and
                 fruit bats and...
BROTHER MAYNARD: Skip a bit brother ...
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui