Hi Yegappan,

2018-8-13(Mon) 10:22:09 UTC+9 [email protected]:
> Hi,
> 
> On Sun, Aug 12, 2018 at 10:02 AM, h_east wrote:
> > Hi Bram and developers,
> >
> > How to reproduce:
> > - Start Vanilla Vim
> >   $ vim --clean
> > - Do :helpgrep with language specifier
> >   :helpg Vim@en
> >
> > Expected behavior:
> > - Match some of them.
> >
> > Actual behavior:
> > - Error(E480: No match) occurs.
> >
> >
> >
> > Investigation result:
> > `eap->arg` has been changed after calling `regmatch.regprog = 
> > vim_regcomp(eap->arg, ...)`..
> > It must be changed before calling `vim_regcomp()`.
> > Because it is necessary to change the regexp search pattern.
> >
> >
> > I attached a patch contains test.
> >
> > PS
> > This issue was reported by Takuya Fujiwara (tyru).
> >
> 
> Can you modify the test to verify lhelpgrep also? You can use something like
> the following:
> 
> 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

Thanks for the suggestions!
I updated a patch.
--
Best regards,
Hirohito Higashi (h_east)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/quickfix.c b/src/quickfix.c
index ac40b24dd..6bc0869c6 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -6843,16 +6843,13 @@ hgr_search_files_in_dir(
 /*
  * 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
+ * '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 *arg)
+hgr_search_in_rtp(qf_info_T *qi, regmatch_T *p_regmatch, char_u *lang)
 {
     char_u	*p;
-#ifdef FEAT_MULTI_LANG
-    char_u	*lang;
-#endif
 
 #ifdef FEAT_MBYTE
     vimconv_T	vc;
@@ -6864,10 +6861,6 @@ hgr_search_in_rtp(qf_info_T *qi, regmatch_T *p_regmatch, char_u *arg)
 	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;
@@ -6902,6 +6895,7 @@ ex_helpgrep(exarg_T *eap)
     qf_info_T	*qi = &ql_info;
     int		new_qi = FALSE;
     char_u	*au_name =  NULL;
+    char_u	*lang = NULL;
 
     switch (eap->cmdidx)
     {
@@ -6918,7 +6912,7 @@ ex_helpgrep(exarg_T *eap)
 #endif
     }
 
-    /* Make 'cpoptions' empty, the 'l' flag should not be used here. */
+    // Make 'cpoptions' empty, the 'l' flag should not be used here.
     save_cpo = p_cpo;
     p_cpo = empty_option;
 
@@ -6929,14 +6923,18 @@ ex_helpgrep(exarg_T *eap)
 	    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 */
+	// create a new quickfix list
 	qf_new_list(qi, qf_cmdtitle(*eap->cmdlinep));
 
-	hgr_search_in_rtp(qi, &regmatch, eap->arg);
+	hgr_search_in_rtp(qi, &regmatch, lang);
 
 	vim_regfree(regmatch.regprog);
 
@@ -6949,7 +6947,7 @@ ex_helpgrep(exarg_T *eap)
     if (p_cpo == empty_option)
 	p_cpo = save_cpo;
     else
-	/* Darn, some plugin changed the value. */
+	// Darn, some plugin changed the value.
 	free_string_option(save_cpo);
 
     qf_list_changed(qi, qi->qf_curlist);
@@ -6960,11 +6958,11 @@ ex_helpgrep(exarg_T *eap)
 	apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
 					       curbuf->b_fname, TRUE, curbuf);
 	if (!new_qi && qi != &ql_info && qf_find_buf(qi) == NULL)
-	    /* autocommands made "qi" invalid */
+	    // autocommands made "qi" invalid
 	    return;
     }
 
-    /* Jump to first match. */
+    // Jump to first match.
     if (!qf_list_empty(qi, qi->qf_curlist))
 	qf_jump(qi, 0, 0, FALSE);
     else
@@ -6972,8 +6970,8 @@ ex_helpgrep(exarg_T *eap)
 
     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 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)
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index ce19e74d3..8c6953230 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -3091,6 +3091,20 @@ func Test_qf_tick()
   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

Raspunde prin e-mail lui