Patch 8.0.1844
Problem:    Superfluous quickfix code, missing examples.
Solution:   Remove unneeded code.  Add a few examples.  Add a bit more
            testing. (Yegappan Lakshmanan, closes #2916)
Files:      runtime/doc/quickfix.txt, src/quickfix.c,
            src/testdir/test_quickfix.vim


*** ../vim-8.0.1843/runtime/doc/quickfix.txt    2018-05-01 15:01:56.934414650 
+0200
--- runtime/doc/quickfix.txt    2018-05-15 21:53:11.901363604 +0200
***************
*** 601,606 ****
--- 597,706 ----
        echo getqflist({'winid' : 1}).winid
        echo getloclist(2, {'winid' : 1}).winid
  <
+                                                       *getqflist-examples*
+ The getqflist() and getloclist() functions can be used to get the various
+ attributes of a quickfix and location list respectively. Some examples for
+ using these functions are below:
+ >
+     " get the title of the current quickfix list
+     :echo getqflist({'title' : 0}).title
+ 
+     " get the identifier of the current quickfix list
+     :let qfid = getqflist({'id' : 0}).id
+ 
+     " get the identifier of the fourth quickfix list in the stack
+     :let qfid = getqflist({'nr' : 4, 'id' : 0}).id
+ 
+     " check whether a quickfix list with a specific identifier exists
+     :if getqflist({'id' : qfid}).id == qfid
+ 
+     " get the index of the current quickfix list in the stack
+     :let qfnum = getqflist({'nr' : 0}).nr
+ 
+     " get the items of a quickfix list specified by an identifier
+     :echo getqflist({'id' : qfid, 'items' : 0}).items
+ 
+     " get the number of entries in a quickfix list specified by an id
+     :echo getqflist({'id' : qfid, 'size' : 0}).size
+ 
+     " get the context of the third quickfix list in the stack
+     :echo getqflist({'nr' : 3, 'context' : 0}).context
+ 
+     " get the number of quickfix lists in the stack
+     :echo getqflist({'nr' : '$'}).nr
+ 
+     " get the number of times the current quickfix list is changed
+     :echo getqflist({'changedtick' : 0}).changedtick
+ 
+     " get the current entry in a quickfix list specified by an identifier
+     :echo getqflist({'id' : qfid, 'idx' : 0}).idx
+ 
+     " get all the quickfix list attributes using an identifier
+     :echo getqflist({'id' : qfid, 'all' : 0})
+ 
+     " parse text from a List of lines and return a quickfix list
+     :let myList = ["a.java:10:L10", "b.java:20:L20"]
+     :echo getqflist({'lines' : myList}).items
+ 
+     " parse text using a custom 'efm' and return a quickfix list
+     :echo getqflist({'lines' : ['a.c#10#Line 10'], 'efm':'%f#%l#%m'}).items
+ 
+     " get the quickfix list window id
+     :echo getqflist({'winid' : 0}).winid
+ 
+     " get the context of the current location list
+     :echo getloclist(0, {'context' : 0}).context
+ 
+     " get the location list window id of the third window
+     :echo getloclist(3, {'winid' : 0}).winid
+ <
+                                                       *setqflist-examples*
+ The setqflist() and setloclist() functions can be used to set the various
+ attributes of a quickfix and location list respectively. Some examples for
+ using these functions are below:
+ >
+     " create an empty quickfix list with a title and a context
+     :let t = 'Search results'
+     :let c = {'cmd' : 'grep'}
+     :call setqflist([], ' ', {'title' : t, 'context' : c})
+ 
+     " set the title of the current quickfix list
+     :call setqflist([], 'a', {'title' : 'Mytitle'})
+ 
+     " set the context of a quickfix list specified by an identifier
+     :call setqflist([], 'a', {'id' : qfid, 'context' : {'val' : 100}})
+ 
+     " create a new quickfix list from a command output
+     :call setqflist([], ' ', {'lines' : systemlist('grep -Hn main *.c')})
+ 
+     " parse text using a custom efm and add to a particular quickfix list
+     :call setqflist([], 'a', {'id' : qfid,
+               \ 'lines' : ["a.c#10#L10", "b.c#20#L20"], 'efm':'%f#%l#%m'})
+ 
+     " add items to the quickfix list specified by an identifier
+     :let newItems = [{'filename' : 'a.txt', 'lnum' : 10, 'text' : "Apple"},
+                   \ {'filename' : 'b.txt', 'lnum' : 20, 'text' : "Orange"}]
+     :call setqflist([], 'a', {'id' : qfid, 'items' : newItems})
+ 
+     " empty a quickfix list specified by an identifier
+     :call setqflist([], 'r', {'id' : qfid, 'items' : []})
+ 
+     " free all the quickfix lists in the stack
+     :call setqflist([], 'f')
+ 
+     " set the title of the fourth quickfix list
+     :call setqflist([], 'a', {'nr' : 4, 'title' : 'SomeTitle'})
+ 
+     " create a new quickfix list at the end of the stack
+     :call setqflist([], ' ', {'nr' : '$',
+                       \ 'lines' : systemlist('grep -Hn class *.java')})
+ 
+     " create a new location list from a command output
+     :call setloclist(0, [], ' ', {'lines' : systemlist('grep -Hn main *.c')})
+ 
+     " replace the location list entries for the third window
+     :call setloclist(3, [], 'r', {'items' : newItems})
+ <
  =============================================================================
  3. Using more than one list of errors                 *quickfix-error-lists*
  
*** ../vim-8.0.1843/src/quickfix.c      2018-05-13 15:28:59.844552232 +0200
--- src/quickfix.c      2018-05-15 21:53:11.901363604 +0200
***************
*** 5798,5813 ****
      title_save = vim_strsave(qi->qf_lists[qf_idx].qf_title);
      retval = qf_add_entries(qi, qf_idx, di->di_tv.vval.v_list,
            title_save, action == ' ' ? 'a' : action);
-     if (action == 'r')
-     {
-       /*
-        * When replacing the quickfix list entries using
-        * qf_add_entries(), the title is set with a ':' prefix.
-        * Restore the title with the saved title.
-        */
-       vim_free(qi->qf_lists[qf_idx].qf_title);
-       qi->qf_lists[qf_idx].qf_title = vim_strsave(title_save);
-     }
      vim_free(title_save);
  
      return retval;
--- 5798,5803 ----
*** ../vim-8.0.1843/src/testdir/test_quickfix.vim       2018-05-13 
15:28:59.844552232 +0200
--- src/testdir/test_quickfix.vim       2018-05-15 21:53:11.901363604 +0200
***************
*** 1185,1190 ****
--- 1185,1197 ----
    call assert_equal(1, len(l), string(l))
    call assert_equal('|| msg2', l[0].text)
  
+   " When matching error lines, case should be ignored. Test for this.
+   set noignorecase
+   let l=getqflist({'lines' : ['Xtest:FOO10:Line 20'], 'efm':'%f:foo%l:%m'})
+   call assert_equal(10, l.items[0].lnum)
+   call assert_equal('Line 20', l.items[0].text)
+   set ignorecase&
+ 
    new | only
    let &efm = save_efm
  endfunc
*** ../vim-8.0.1843/src/version.c       2018-05-15 21:42:17.113670086 +0200
--- src/version.c       2018-05-15 21:53:41.985169296 +0200
***************
*** 763,764 ****
--- 763,766 ----
  {   /* Add new patch number below this line */
+ /**/
+     1844,
  /**/

-- 
Zen Microsystems: we're the om in .commmmmmmmm

 /// 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