summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1221
blob: bc64a892acf4e86075635ad2418aff7e77fa120b (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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1221
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.1221
Problem:    Filtering does not work when listing marks.
Solution:   Implement filtering marks. (Marcin Szamotulski, closes #3895)
Files:	    runtime/doc/various.txt, src/mark.c,
            src/testdir/test_filter_cmd.vim


*** ../vim-8.1.1220/runtime/doc/various.txt	2019-04-27 13:03:20.012715914 +0200
--- runtime/doc/various.txt	2019-04-27 22:29:37.358502260 +0200
***************
*** 573,589 ****
  			the output, not necessarily the whole line. Only some
  			commands support filtering, try it out to check if it
  			works. Some of the commands that support filtering:
!                           |:#|          - filter whole line
!                           |:command|    - filter by command name
!                           |:files|      - filter by file name
!                           |:highlight|  - filter by highlight group
!                           |:jumps|      - filter by file name
!                           |:let|        - filter by variable name
!                           |:list|       - filter whole line
!                           |:llist|      - filter by file name or module name
!                           |:oldfiles|   - filter by file name
!                           |:clist|      - filter by file name or module name
!                           |:set|        - filter by variable name
  
  			Only normal messages are filtered, error messages are
  			not.
--- 571,589 ----
  			the output, not necessarily the whole line. Only some
  			commands support filtering, try it out to check if it
  			works. Some of the commands that support filtering:
! 			   |:#|          - filter whole line
! 			   |:clist|      - filter by file name or module name
! 			   |:command|    - filter by command name
! 			   |:files|      - filter by file name
! 			   |:highlight|  - filter by highlight group
! 			   |:jumps|      - filter by file name
! 			   |:let|        - filter by variable name
! 			   |:list|       - filter whole line
! 			   |:llist|      - filter by file name or module name
! 			   |:marks|      - filter by text in the current file,
! 					   or file name for other files
! 			   |:oldfiles|   - filter by file name
! 			   |:set|        - filter by variable name
  
  			Only normal messages are filtered, error messages are
  			not.
*** ../vim-8.1.1220/src/mark.c	2019-01-27 15:07:35.161741346 +0100
--- src/mark.c	2019-04-27 22:28:39.730756612 +0200
***************
*** 744,754 ****
      int		c,
      char_u	*arg,
      pos_T	*p,
!     char_u	*name,
      int		current)	/* in current file */
  {
      static int	did_title = FALSE;
      int		mustfree = FALSE;
  
      if (c == -1)			    /* finish up */
      {
--- 744,755 ----
      int		c,
      char_u	*arg,
      pos_T	*p,
!     char_u	*name_arg,
      int		current)	/* in current file */
  {
      static int	did_title = FALSE;
      int		mustfree = FALSE;
+     char_u	*name = name_arg;
  
      if (c == -1)			    /* finish up */
      {
***************
*** 762,796 ****
  		semsg(_("E283: No marks matching \"%s\""), arg);
  	}
      }
!     /* don't output anything if 'q' typed at --more-- prompt */
      else if (!got_int
  	    && (arg == NULL || vim_strchr(arg, c) != NULL)
  	    && p->lnum != 0)
      {
! 	if (!did_title)
  	{
! 	    /* Highlight title */
! 	    msg_puts_title(_("\nmark line  col file/text"));
! 	    did_title = TRUE;
  	}
! 	msg_putchar('\n');
! 	if (!got_int)
  	{
! 	    sprintf((char *)IObuff, " %c %6ld %4d ", c, p->lnum, p->col);
! 	    msg_outtrans(IObuff);
! 	    if (name == NULL && current)
  	    {
! 		name = mark_line(p, 15);
! 		mustfree = TRUE;
  	    }
! 	    if (name != NULL)
  	    {
! 		msg_outtrans_attr(name, current ? HL_ATTR(HLF_D) : 0);
! 		if (mustfree)
! 		    vim_free(name);
  	    }
  	}
! 	out_flush();		    /* show one line at a time */
      }
  }
  
--- 763,800 ----
  		semsg(_("E283: No marks matching \"%s\""), arg);
  	}
      }
!     // don't output anything if 'q' typed at --more-- prompt
      else if (!got_int
  	    && (arg == NULL || vim_strchr(arg, c) != NULL)
  	    && p->lnum != 0)
      {
! 	if (name == NULL && current)
  	{
! 	    name = mark_line(p, 15);
! 	    mustfree = TRUE;
  	}
! 	if (!message_filtered(name))
  	{
! 	    if (!did_title)
  	    {
! 		// Highlight title
! 		msg_puts_title(_("\nmark line  col file/text"));
! 		did_title = TRUE;
  	    }
! 	    msg_putchar('\n');
! 	    if (!got_int)
  	    {
! 		sprintf((char *)IObuff, " %c %6ld %4d ", c, p->lnum, p->col);
! 		msg_outtrans(IObuff);
! 		if (name != NULL)
! 		{
! 		    msg_outtrans_attr(name, current ? HL_ATTR(HLF_D) : 0);
! 		}
  	    }
+ 	    out_flush();		    // show one line at a time
  	}
! 	if (mustfree)
! 	    vim_free(name);
      }
  }
  
*** ../vim-8.1.1220/src/testdir/test_filter_cmd.vim	2018-11-03 18:59:49.690644045 +0100
--- src/testdir/test_filter_cmd.vim	2019-04-27 22:33:07.745561137 +0200
***************
*** 126,132 ****
    let res = split(execute("filter /\.c$/ jumps"), "\n")[1:]
    call assert_equal(["   2     1    0 file.c", ">"], res)
  
!   bwipe file.c
!   bwipe file.h
!   bwipe file.hs
  endfunc
--- 126,147 ----
    let res = split(execute("filter /\.c$/ jumps"), "\n")[1:]
    call assert_equal(["   2     1    0 file.c", ">"], res)
  
!   " Test filtering :marks command
!   b file.c
!   mark A
!   b file.h
!   mark B
!   let res = split(execute("filter /\.c$/ marks"), "\n")[1:]
!   call assert_equal([" A      1    0 file.c"], res)
! 
!   call setline(1, ['one', 'two', 'three'])
!   1mark a
!   2mark b
!   3mark c
!   let res = split(execute("filter /two/ marks abc"), "\n")[1:]
!   call assert_equal([" b      2    0 two"], res)
! 
!   bwipe! file.c
!   bwipe! file.h
!   bwipe! file.hs
  endfunc
*** ../vim-8.1.1220/src/version.c	2019-04-27 22:38:26.788107972 +0200
--- src/version.c	2019-04-27 22:39:21.911854726 +0200
***************
*** 769,770 ****
--- 769,772 ----
  {   /* Add new patch number below this line */
+ /**/
+     1221,
  /**/

-- 
Witches prefer brooms: vacuum-cleaners need extension cords!

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