summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0315
blob: cea600e2bca36f63c8ea08a9173f8c67292cd6c1 (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
213
214
215
216
217
218
219
220
221
222
223
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0315
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.0315
Problem:    Helpgrep with language doesn't work properly. (Takuya Fujiwara)
Solution:   Check for the language earlier. (Hirohito Higashi)
Files:	    src/quickfix.c, src/testdir/test_quickfix.vim


*** ../vim-8.1.0314/src/quickfix.c	2018-08-18 19:59:48.418322409 +0200
--- src/quickfix.c	2018-08-21 21:47:55.412902244 +0200
***************
*** 5385,5391 ****
      if (qf_restore_list(qi, save_qfid) == FAIL)
  	goto theend;
  
!     /* Jump to first match. */
      if (!qf_list_empty(qi, qi->qf_curlist))
      {
  	if ((flags & VGR_NOJUMP) == 0)
--- 5385,5391 ----
      if (qf_restore_list(qi, save_qfid) == FAIL)
  	goto theend;
  
!     // Jump to first match.
      if (!qf_list_empty(qi, qi->qf_curlist))
      {
  	if ((flags & VGR_NOJUMP) == 0)
***************
*** 6844,6859 ****
  /*
   * Search for a pattern in all the help files in the 'runtimepath'
   * and add the matches to a quickfix list.
!  * 'arg' is the language specifier.  If supplied, then only matches in the
   * specified language are found.
   */
      static void
! hgr_search_in_rtp(qf_info_T *qi, regmatch_T *p_regmatch, char_u *arg)
  {
      char_u	*p;
- #ifdef FEAT_MULTI_LANG
-     char_u	*lang;
- #endif
  
  #ifdef FEAT_MBYTE
      vimconv_T	vc;
--- 6844,6856 ----
  /*
   * Search for a pattern in all the help files in the 'runtimepath'
   * and add the matches to a quickfix list.
!  * 'lang' is the language specifier.  If supplied, then only matches in the
   * specified language are found.
   */
      static void
! hgr_search_in_rtp(qf_info_T *qi, regmatch_T *p_regmatch, char_u *lang)
  {
      char_u	*p;
  
  #ifdef FEAT_MBYTE
      vimconv_T	vc;
***************
*** 6865,6874 ****
  	convert_setup(&vc, (char_u *)"utf-8", p_enc);
  #endif
  
- #ifdef FEAT_MULTI_LANG
-     /* Check for a specified language */
-     lang = check_help_lang(arg);
- #endif
  
      /* Go through all the directories in 'runtimepath' */
      p = p_rtp;
--- 6862,6867 ----
***************
*** 6903,6908 ****
--- 6896,6902 ----
      qf_info_T	*qi = &ql_info;
      int		new_qi = FALSE;
      char_u	*au_name =  NULL;
+     char_u	*lang = NULL;
  
      switch (eap->cmdidx)
      {
***************
*** 6919,6925 ****
  #endif
      }
  
!     /* Make 'cpoptions' empty, the 'l' flag should not be used here. */
      save_cpo = p_cpo;
      p_cpo = empty_option;
  
--- 6913,6919 ----
  #endif
      }
  
!     // Make 'cpoptions' empty, the 'l' flag should not be used here.
      save_cpo = p_cpo;
      p_cpo = empty_option;
  
***************
*** 6930,6943 ****
  	    return;
      }
  
      regmatch.regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING);
      regmatch.rm_ic = FALSE;
      if (regmatch.regprog != NULL)
      {
! 	/* create a new quickfix list */
  	qf_new_list(qi, qf_cmdtitle(*eap->cmdlinep));
  
! 	hgr_search_in_rtp(qi, &regmatch, eap->arg);
  
  	vim_regfree(regmatch.regprog);
  
--- 6924,6941 ----
  	    return;
      }
  
+ #ifdef FEAT_MULTI_LANG
+     // Check for a specified language
+     lang = check_help_lang(eap->arg);
+ #endif
      regmatch.regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING);
      regmatch.rm_ic = FALSE;
      if (regmatch.regprog != NULL)
      {
! 	// create a new quickfix list
  	qf_new_list(qi, qf_cmdtitle(*eap->cmdlinep));
  
! 	hgr_search_in_rtp(qi, &regmatch, lang);
  
  	vim_regfree(regmatch.regprog);
  
***************
*** 6950,6956 ****
      if (p_cpo == empty_option)
  	p_cpo = save_cpo;
      else
! 	/* Darn, some plugin changed the value. */
  	free_string_option(save_cpo);
  
      qf_list_changed(qi, qi->qf_curlist);
--- 6948,6954 ----
      if (p_cpo == empty_option)
  	p_cpo = save_cpo;
      else
! 	// Darn, some plugin changed the value.
  	free_string_option(save_cpo);
  
      qf_list_changed(qi, qi->qf_curlist);
***************
*** 6973,6980 ****
  
      if (eap->cmdidx == CMD_lhelpgrep)
      {
! 	/* If the help window is not opened or if it already points to the
! 	 * correct location list, then free the new location list. */
  	if (!bt_help(curwin->w_buffer) || curwin->w_llist == qi)
  	{
  	    if (new_qi)
--- 6971,6978 ----
  
      if (eap->cmdidx == CMD_lhelpgrep)
      {
! 	// If the help window is not opened or if it already points to the
! 	// correct location list, then free the new location list.
  	if (!bt_help(curwin->w_buffer) || curwin->w_llist == qi)
  	{
  	    if (new_qi)
*** ../vim-8.1.0314/src/testdir/test_quickfix.vim	2018-08-15 22:29:46.977604162 +0200
--- src/testdir/test_quickfix.vim	2018-08-21 21:44:49.058013219 +0200
***************
*** 3091,3096 ****
--- 3091,3110 ----
    call Xqftick_tests('l')
  endfunc
  
+ " Test helpgrep with lang specifier
+ func Xtest_helpgrep_with_lang_specifier(cchar)
+   call s:setup_commands(a:cchar)
+   Xhelpgrep Vim@en
+   call assert_equal('help', &filetype)
+   call assert_notequal(0, g:Xgetlist({'nr' : '$'}).nr)
+   new | only
+ endfunc
+ 
+ func Test_helpgrep_with_lang_specifier()
+   call Xtest_helpgrep_with_lang_specifier('c')
+   call Xtest_helpgrep_with_lang_specifier('l')
+ endfunc
+ 
  " The following test used to crash Vim.
  " Open the location list window and close the regular window associated with
  " the location list. When the garbage collection runs now, it incorrectly
*** ../vim-8.1.0314/src/version.c	2018-08-21 21:09:02.598739663 +0200
--- src/version.c	2018-08-21 21:50:24.460013769 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     315,
  /**/

-- 
BLACK KNIGHT: None shall pass.
ARTHUR:       I have no quarrel with you, brave Sir knight, but I must cross
              this bridge.
BLACK KNIGHT: Then you shall die.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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