]> granicus.if.org Git - vim/commitdiff
patch 8.0.1844: superfluous quickfix code, missing examples v8.0.1844
authorBram Moolenaar <Bram@vim.org>
Tue, 15 May 2018 19:56:34 +0000 (21:56 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 15 May 2018 19:56:34 +0000 (21:56 +0200)
Problem:    Superfluous quickfix code, missing examples.
Solution:   Remove unneeded code.  Add a few examples.  Add a bit more
            testing. (Yegappan Lakshmanan, closes #2916)

runtime/doc/quickfix.txt
src/quickfix.c
src/testdir/test_quickfix.vim
src/version.c

index 83379b81a582871cb1d926269128ad798e469cf7..5f2a4ddf2b36673f7585e777d6e672bb00d52eae 100644 (file)
@@ -608,6 +608,12 @@ using these functions are below:
     " 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
 
@@ -653,6 +659,11 @@ 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'})
 
@@ -671,6 +682,9 @@ using these functions are below:
                    \ {'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')
 
index 98360d01999bc97743d2c3396022b4397a0053e6..f8bfa41e33af4fa7a26ead45d0f8c454210ebae2 100644 (file)
@@ -5798,16 +5798,6 @@ qf_setprop_items(qf_info_T *qi, int qf_idx, dictitem_T *di, int action)
     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;
index 985b28129113990377f21dd2b789eef66f1b41ac..c3850ce1f41eb213ba001493b5d33a310e0a7365 100644 (file)
@@ -1185,6 +1185,13 @@ func Test_efm2()
   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
index 788ba2462e4dee68c95d2b9d826a9a981cabdbaa..145167dabd69cbdfbd75f9a38c2ce756edefcdb6 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1844,
 /**/
     1843,
 /**/