Skip to content

Commit 78ddc06

Browse files
committed
patch 8.0.1844: superfluous quickfix code, missing examples
Problem: Superfluous quickfix code, missing examples. Solution: Remove unneeded code. Add a few examples. Add a bit more testing. (Yegappan Lakshmanan, closes #2916)
1 parent 8776889 commit 78ddc06

4 files changed

Lines changed: 23 additions & 10 deletions

File tree

runtime/doc/quickfix.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,12 @@ using these functions are below:
608608
" get the identifier of the current quickfix list
609609
:let qfid = getqflist({'id' : 0}).id
610610

611+
" get the identifier of the fourth quickfix list in the stack
612+
:let qfid = getqflist({'nr' : 4, 'id' : 0}).id
613+
614+
" check whether a quickfix list with a specific identifier exists
615+
:if getqflist({'id' : qfid}).id == qfid
616+
611617
" get the index of the current quickfix list in the stack
612618
:let qfnum = getqflist({'nr' : 0}).nr
613619

@@ -653,6 +659,11 @@ The setqflist() and setloclist() functions can be used to set the various
653659
attributes of a quickfix and location list respectively. Some examples for
654660
using these functions are below:
655661
>
662+
" create an empty quickfix list with a title and a context
663+
:let t = 'Search results'
664+
:let c = {'cmd' : 'grep'}
665+
:call setqflist([], ' ', {'title' : t, 'context' : c})
666+
656667
" set the title of the current quickfix list
657668
:call setqflist([], 'a', {'title' : 'Mytitle'})
658669

@@ -671,6 +682,9 @@ using these functions are below:
671682
\ {'filename' : 'b.txt', 'lnum' : 20, 'text' : "Orange"}]
672683
:call setqflist([], 'a', {'id' : qfid, 'items' : newItems})
673684

685+
" empty a quickfix list specified by an identifier
686+
:call setqflist([], 'r', {'id' : qfid, 'items' : []})
687+
674688
" free all the quickfix lists in the stack
675689
:call setqflist([], 'f')
676690

src/quickfix.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5798,16 +5798,6 @@ qf_setprop_items(qf_info_T *qi, int qf_idx, dictitem_T *di, int action)
57985798
title_save = vim_strsave(qi->qf_lists[qf_idx].qf_title);
57995799
retval = qf_add_entries(qi, qf_idx, di->di_tv.vval.v_list,
58005800
title_save, action == ' ' ? 'a' : action);
5801-
if (action == 'r')
5802-
{
5803-
/*
5804-
* When replacing the quickfix list entries using
5805-
* qf_add_entries(), the title is set with a ':' prefix.
5806-
* Restore the title with the saved title.
5807-
*/
5808-
vim_free(qi->qf_lists[qf_idx].qf_title);
5809-
qi->qf_lists[qf_idx].qf_title = vim_strsave(title_save);
5810-
}
58115801
vim_free(title_save);
58125802

58135803
return retval;

src/testdir/test_quickfix.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,13 @@ func Test_efm2()
11851185
call assert_equal(1, len(l), string(l))
11861186
call assert_equal('|| msg2', l[0].text)
11871187

1188+
" When matching error lines, case should be ignored. Test for this.
1189+
set noignorecase
1190+
let l=getqflist({'lines' : ['Xtest:FOO10:Line 20'], 'efm':'%f:foo%l:%m'})
1191+
call assert_equal(10, l.items[0].lnum)
1192+
call assert_equal('Line 20', l.items[0].text)
1193+
set ignorecase&
1194+
11881195
new | only
11891196
let &efm = save_efm
11901197
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static char *(features[]) =
761761

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
1844,
764766
/**/
765767
1843,
766768
/**/

0 commit comments

Comments
 (0)