Patch 8.2.0933
Problem:    'quickfixtextfunc' does not get window ID of location list.
Solution:   Add "winid" to the dict argument. (Yegappan Lakshmanan,
            closes #6222)
Files:      runtime/doc/quickfix.txt, src/quickfix.c,
            src/testdir/test_quickfix.vim


*** ../vim-8.2.0932/runtime/doc/quickfix.txt    2020-06-07 14:10:34.896126427 
+0200
--- runtime/doc/quickfix.txt    2020-06-08 19:16:54.224572111 +0200
***************
*** 1954,1959 ****
--- 1953,1961 ----
  
      quickfix  set to 1 when called for a quickfix list and 0 when called for
                a location list.
+     winid     for a location list, set to the id of the window with the
+               location list. For a quickfix list, set to 0. Can be used in
+               getloclist() to get the location list entry.
      id                quickfix or location list identifier
      idx               index of the entry in the quickfix or location list
  
*** ../vim-8.2.0932/src/quickfix.c      2020-06-07 14:10:34.896126427 +0200
--- src/quickfix.c      2020-06-08 19:16:54.224572111 +0200
***************
*** 175,181 ****
  static win_T  *qf_find_win(qf_info_T *qi);
  static buf_T  *qf_find_buf(qf_info_T *qi);
  static void   qf_update_buffer(qf_info_T *qi, qfline_T *old_last);
! static void   qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last);
  static buf_T  *load_dummy_buffer(char_u *fname, char_u *dirname_start, char_u 
*resulting_dir);
  static void   wipe_dummy_buffer(buf_T *buf, char_u *dirname_start);
  static void   unload_dummy_buffer(buf_T *buf, char_u *dirname_start);
--- 175,181 ----
  static win_T  *qf_find_win(qf_info_T *qi);
  static buf_T  *qf_find_buf(qf_info_T *qi);
  static void   qf_update_buffer(qf_info_T *qi, qfline_T *old_last);
! static void   qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, 
int qf_winid);
  static buf_T  *load_dummy_buffer(char_u *fname, char_u *dirname_start, char_u 
*resulting_dir);
  static void   wipe_dummy_buffer(buf_T *buf, char_u *dirname_start);
  static void   unload_dummy_buffer(buf_T *buf, char_u *dirname_start);
***************
*** 4189,4195 ****
      lnum = qfl->qf_index;
  
      // Fill the buffer with the quickfix list.
!     qf_fill_buffer(qfl, curbuf, NULL);
  
      decr_quickfix_busy();
  
--- 4189,4195 ----
      lnum = qfl->qf_index;
  
      // Fill the buffer with the quickfix list.
!     qf_fill_buffer(qfl, curbuf, NULL, curwin->w_id);
  
      decr_quickfix_busy();
  
***************
*** 4381,4386 ****
--- 4381,4390 ----
      if (buf != NULL)
      {
        linenr_T        old_line_count = buf->b_ml.ml_line_count;
+       int             qf_winid = 0;
+ 
+       if (IS_LL_STACK(qi))
+           qf_winid = curwin->w_id;
  
        if (old_last == NULL)
            // set curwin/curbuf to buf and save a few things
***************
*** 4388,4394 ****
  
        qf_update_win_titlevar(qi);
  
!       qf_fill_buffer(qf_get_curlist(qi), buf, old_last);
        ++CHANGEDTICK(buf);
  
        if (old_last == NULL)
--- 4392,4398 ----
  
        qf_update_win_titlevar(qi);
  
!       qf_fill_buffer(qf_get_curlist(qi), buf, old_last, qf_winid);
        ++CHANGEDTICK(buf);
  
        if (old_last == NULL)
***************
*** 4415,4421 ****
        buf_T           *buf,           // quickfix window buffer
        linenr_T        lnum,
        qfline_T        *qfp,
!       char_u          *dirname)
  {
      int               len;
      buf_T     *errbuf;
--- 4419,4426 ----
        buf_T           *buf,           // quickfix window buffer
        linenr_T        lnum,
        qfline_T        *qfp,
!       char_u          *dirname,
!       int             qf_winid)
  {
      int               len;
      buf_T     *errbuf;
***************
*** 4433,4442 ****
        typval_T        args[1];
        dict_T          *d;
  
!       // create 'info' dict argument
        if ((d = dict_alloc_lock(VAR_FIXED)) == NULL)
            return FAIL;
        dict_add_number(d, "quickfix", (long)IS_QF_LIST(qfl));
        dict_add_number(d, "id", (long)qfl->qf_id);
        dict_add_number(d, "idx", (long)(lnum + 1));
        ++d->dv_refcount;
--- 4438,4448 ----
        typval_T        args[1];
        dict_T          *d;
  
!       // create the dict argument
        if ((d = dict_alloc_lock(VAR_FIXED)) == NULL)
            return FAIL;
        dict_add_number(d, "quickfix", (long)IS_QF_LIST(qfl));
+       dict_add_number(d, "winid", (long)qf_winid);
        dict_add_number(d, "id", (long)qfl->qf_id);
        dict_add_number(d, "idx", (long)(lnum + 1));
        ++d->dv_refcount;
***************
*** 4535,4541 ****
   * ml_delete() is used and autocommands will be triggered.
   */
      static void
! qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last)
  {
      linenr_T  lnum;
      qfline_T  *qfp;
--- 4541,4547 ----
   * ml_delete() is used and autocommands will be triggered.
   */
      static void
! qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int qf_winid)
  {
      linenr_T  lnum;
      qfline_T  *qfp;
***************
*** 4574,4580 ****
        }
        while (lnum < qfl->qf_count)
        {
!           if (qf_buf_add_line(qfl, buf, lnum, qfp, dirname) == FAIL)
                break;
  
            ++lnum;
--- 4580,4586 ----
        }
        while (lnum < qfl->qf_count)
        {
!           if (qf_buf_add_line(qfl, buf, lnum, qfp, dirname, qf_winid) == FAIL)
                break;
  
            ++lnum;
*** ../vim-8.2.0932/src/testdir/test_quickfix.vim       2020-06-07 
14:10:34.900126463 +0200
--- src/testdir/test_quickfix.vim       2020-06-08 19:16:54.228572094 +0200
***************
*** 4822,4828 ****
      let qfl = getqflist({'id' : a:info.id, 'idx' : a:info.idx,
            \ 'items' : 1}).items
    else
!     let qfl = getloclist(0, {'id' : a:info.id, 'idx' : a:info.idx,
            \ 'items' : 1}).items
    endif
  
--- 4822,4828 ----
      let qfl = getqflist({'id' : a:info.id, 'idx' : a:info.idx,
            \ 'items' : 1}).items
    else
!     let qfl = getloclist(a:info.winid, {'id' : a:info.id, 'idx' : a:info.idx,
            \ 'items' : 1}).items
    endif
  
***************
*** 4863,4869 ****
        let qfl = getqflist({'id' : a:info.id, 'idx' : a:info.idx,
              \ 'items' : 1}).items
      else
!       let qfl = getloclist(0, {'id' : a:info.id, 'idx' : a:info.idx,
              \ 'items' : 1}).items
      endif
      if empty(qfl)
--- 4863,4869 ----
        let qfl = getqflist({'id' : a:info.id, 'idx' : a:info.idx,
              \ 'items' : 1}).items
      else
!       let qfl = getloclist(a:info.winid, {'id' : a:info.id, 'idx' : 
a:info.idx,
              \ 'items' : 1}).items
      endif
      if empty(qfl)
***************
*** 4878,4883 ****
--- 4878,4888 ----
    call assert_equal('Line 10, Col 2', getline(1))
    call assert_equal('Line 20, Col 4', getline(2))
    Xclose
+   " Add entries to the list when the quickfix buffer is hidden
+   Xaddexpr ['F1:30:6:red']
+   Xwindow
+   call assert_equal('Line 30, Col 6', getline(3))
+   Xclose
    call g:Xsetlist([], 'r', {'quickfixtextfunc' : ''})
    set quickfixtextfunc&
    delfunc PerQfText
*** ../vim-8.2.0932/src/version.c       2020-06-08 18:54:44.957796367 +0200
--- src/version.c       2020-06-08 19:19:29.359987225 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     933,
  /**/

-- 
You were lucky to have a LAKE! There were a hundred and sixty of
us living in a small shoebox in the middle of the road.

 /// 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/202006081721.058HLhJ0350177%40masaka.moolenaar.net.

Raspunde prin e-mail lui