summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0165
blob: 39977900c7aabd7ee95e557dab2f1732d56c8ce7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0165
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.0165
Problem:    :clist output can be very long.
Solution:   Support filtering :clist entries. (Yegappan Lakshmanan)
Files:	    src/quickfix.c, src/testdir/test_quickfix.vim


*** ../vim-8.1.0164/src/quickfix.c	Tue Jul  3 16:54:18 2018
--- src/quickfix.c	Sun Jul  8 15:53:26 2018
***************
*** 3051,3056 ****
--- 3051,3057 ----
      int		qfFileAttr;
      int		qfSepAttr;
      int		qfLineAttr;
+     int		filter_entry;
      int		all = eap->forceit;	/* if not :cl!, only show
  						   recognised errors */
      qf_info_T	*qi = &ql_info;
***************
*** 3120,3126 ****
      {
  	if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2)
  	{
- 	    msg_putchar('\n');
  	    if (got_int)
  		break;
  
--- 3121,3126 ----
***************
*** 3141,3146 ****
--- 3141,3160 ----
  		    vim_snprintf((char *)IObuff, IOSIZE, "%2d %s",
  								i, (char *)fname);
  	    }
+ 
+ 	    // Support for filtering entries using :filter /pat/ clist
+ 	    filter_entry = 1;
+ 	    if (qfp->qf_module != NULL && *qfp->qf_module != NUL)
+ 		filter_entry &= message_filtered(qfp->qf_module);
+ 	    if (fname != NULL)
+ 		filter_entry &= message_filtered(fname);
+ 	    if (qfp->qf_pattern != NULL)
+ 		filter_entry &= message_filtered(qfp->qf_pattern);
+ 	    filter_entry &= message_filtered(qfp->qf_text);
+ 	    if (filter_entry)
+ 		goto next_entry;
+ 
+ 	    msg_putchar('\n');
  	    msg_outtrans_attr(IObuff, i == qi->qf_lists[qi->qf_curlist].qf_index
  					   ? HL_ATTR(HLF_QFL) : qfFileAttr);
  
***************
*** 3175,3180 ****
--- 3189,3195 ----
  	    out_flush();		/* show one line at a time */
  	}
  
+ next_entry:
  	qfp = qfp->qf_next;
  	if (qfp == NULL)
  	    break;
***************
*** 4186,4191 ****
--- 4201,4207 ----
      }
      if (res >= 0)
  	qf_list_changed(qi, qi->qf_curlist);
+ 
      // Remember the current quickfix list identifier, so that we can
      // check for autocommands changing the current quickfix list.
      save_qfid = qi->qf_lists[qi->qf_curlist].qf_id;
*** ../vim-8.1.0164/src/testdir/test_quickfix.vim	Tue Jul  3 19:15:56 2018
--- src/testdir/test_quickfix.vim	Sun Jul  8 15:53:26 2018
***************
*** 3487,3489 ****
--- 3487,3506 ----
    call Xautocmd_changelist('c')
    call Xautocmd_changelist('l')
  endfunc
+ 
+ " Tests for the ':filter /pat/ clist' command
+ func Test_filter_clist()
+   cexpr ['Xfile1:10:10:Line 10', 'Xfile2:15:15:Line 15']
+   call assert_equal([' 2 Xfile2:15 col 15: Line 15'],
+ 			\ split(execute('filter /Line 15/ clist'), "\n"))
+   call assert_equal([' 1 Xfile1:10 col 10: Line 10'],
+ 			\ split(execute('filter /Xfile1/ clist'), "\n"))
+   call assert_equal([], split(execute('filter /abc/ clist'), "\n"))
+ 
+   call setqflist([{'module' : 'abc', 'pattern' : 'pat1'},
+ 			\ {'module' : 'pqr', 'pattern' : 'pat2'}], ' ')
+   call assert_equal([' 2 pqr:pat2:  '],
+ 			\ split(execute('filter /pqr/ clist'), "\n"))
+   call assert_equal([' 1 abc:pat1:  '],
+ 			\ split(execute('filter /pat1/ clist'), "\n"))
+ endfunc
*** ../vim-8.1.0164/src/version.c	Sat Jul  7 23:07:35 2018
--- src/version.c	Sun Jul  8 15:54:40 2018
***************
*** 791,792 ****
--- 791,794 ----
  {   /* Add new patch number below this line */
+ /**/
+     165,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
204. You're being audited because you mailed your tax return to the IRC.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- 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    ///