Patch 8.2.3018
Problem:    Formatting using quickfixtextfunc is lost when updating location
            lists for different buffers.  (Yorick Peterse)
Solution:   Use the right window for the locaiton list. (Yegappan Lakshmanan,
            closes #8400, closes #8403)
Files:      src/quickfix.c, src/testdir/test_quickfix.vim


*** ../vim-8.2.3017/src/quickfix.c      2021-06-02 13:28:11.435120452 +0200
--- src/quickfix.c      2021-06-19 18:16:44.669502608 +0200
***************
*** 4473,4479 ****
        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
--- 4473,4489 ----
        int             qf_winid = 0;
  
        if (IS_LL_STACK(qi))
!       {
!           if (curwin->w_llist == qi)
!               win = curwin;
!           else
!           {
!               win = qf_find_win_with_loclist(qi);
!               if (win == NULL)
!                   return;
!           }
!           qf_winid = win->w_id;
!       }
  
        if (old_last == NULL)
            // set curwin/curbuf to buf and save a few things
*** ../vim-8.2.3017/src/testdir/test_quickfix.vim       2021-05-05 
21:31:36.068018579 +0200
--- src/testdir/test_quickfix.vim       2021-06-19 18:16:44.673502585 +0200
***************
*** 5231,5236 ****
--- 5231,5294 ----
    call Xtest_qftextfunc('l')
  endfunc
  
+ " Test for updating a location list for some other window and check that
+ " 'qftextfunc' uses the correct location list.
+ func Test_qftextfunc_other_loclist()
+   %bw!
+   call setloclist(0, [], 'f')
+ 
+   " create a window and a location list for it and open the location list
+   " window
+   lexpr ['F1:10:12:one', 'F1:20:14:two']
+   let w1_id = win_getid()
+   call setloclist(0, [], ' ',
+         \ {'lines': ['F1:10:12:one', 'F1:20:14:two'],
+         \  'quickfixtextfunc':
+         \    {d -> map(getloclist(d.winid, {'id' : d.id,
+         \                'items' : 1}).items[d.start_idx-1:d.end_idx-1],
+         \          "'Line ' .. v:val.lnum .. ', Col ' .. v:val.col")}})
+   lwindow
+   let w2_id = win_getid()
+ 
+   " create another window and a location list for it and open the location
+   " list window
+   topleft new
+   let w3_id = win_getid()
+   call setloclist(0, [], ' ',
+         \ {'lines': ['F2:30:32:eleven', 'F2:40:34:twelve'],
+         \  'quickfixtextfunc':
+         \    {d -> map(getloclist(d.winid, {'id' : d.id,
+         \                'items' : 1}).items[d.start_idx-1:d.end_idx-1],
+         \          "'Ligne ' .. v:val.lnum .. ', Colonne ' .. v:val.col")}})
+   lwindow
+   let w4_id = win_getid()
+ 
+   topleft new
+   lexpr ['F3:50:52:green', 'F3:60:54:blue']
+   let w5_id = win_getid()
+ 
+   " change the location list for some other window
+   call setloclist(0, [], 'r', {'lines': ['F3:55:56:aaa', 'F3:57:58:bbb']})
+   call setloclist(w1_id, [], 'r', {'lines': ['F1:62:63:bbb', 'F1:64:65:ccc']})
+   call setloclist(w3_id, [], 'r', {'lines': ['F2:76:77:ddd', 'F2:78:79:eee']})
+   call assert_equal(['Line 62, Col 63', 'Line 64, Col 65'],
+         \ getbufline(winbufnr(w2_id), 1, '$'))
+   call assert_equal(['Ligne 76, Colonne 77', 'Ligne 78, Colonne 79'],
+         \ getbufline(winbufnr(w4_id), 1, '$'))
+   call setloclist(w2_id, [], 'r', {'lines': ['F1:32:33:fff', 'F1:34:35:ggg']})
+   call setloclist(w4_id, [], 'r', {'lines': ['F2:46:47:hhh', 'F2:48:49:jjj']})
+   call assert_equal(['Line 32, Col 33', 'Line 34, Col 35'],
+         \ getbufline(winbufnr(w2_id), 1, '$'))
+   call assert_equal(['Ligne 46, Colonne 47', 'Ligne 48, Colonne 49'],
+         \ getbufline(winbufnr(w4_id), 1, '$'))
+ 
+   call win_gotoid(w5_id)
+   lwindow
+   call assert_equal(['F3|55 col 56| aaa', 'F3|57 col 58| bbb'],
+         \ getline(1, '$'))
+   %bw!
+ endfunc
+ 
  " Running :lhelpgrep command more than once in a help window, doesn't jump to
  " the help topic
  func Test_lhelpgrep_from_help_window()
*** ../vim-8.2.3017/src/version.c       2021-06-17 22:27:44.505773022 +0200
--- src/version.c       2021-06-19 18:20:49.528244304 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     3018,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
18. Your wife drapes a blond wig over your monitor to remind you of what she
    looks like.

 /// 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/202106191623.15JGNNCx071327%40masaka.moolenaar.net.

Raspunde prin e-mail lui