mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.1.0315: helpgrep with language doesn't work properly
Problem: Helpgrep with language doesn't work properly. (Takuya Fujiwara) Solution: Check for the language earlier. (Hirohito Higashi)
This commit is contained in:
@@ -5385,7 +5385,7 @@ ex_vimgrep(exarg_T *eap)
|
|||||||
if (qf_restore_list(qi, save_qfid) == FAIL)
|
if (qf_restore_list(qi, save_qfid) == FAIL)
|
||||||
goto theend;
|
goto theend;
|
||||||
|
|
||||||
/* Jump to first match. */
|
// Jump to first match.
|
||||||
if (!qf_list_empty(qi, qi->qf_curlist))
|
if (!qf_list_empty(qi, qi->qf_curlist))
|
||||||
{
|
{
|
||||||
if ((flags & VGR_NOJUMP) == 0)
|
if ((flags & VGR_NOJUMP) == 0)
|
||||||
@@ -6844,16 +6844,13 @@ hgr_search_files_in_dir(
|
|||||||
/*
|
/*
|
||||||
* Search for a pattern in all the help files in the 'runtimepath'
|
* Search for a pattern in all the help files in the 'runtimepath'
|
||||||
* and add the matches to a quickfix list.
|
* 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.
|
* specified language are found.
|
||||||
*/
|
*/
|
||||||
static void
|
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;
|
char_u *p;
|
||||||
#ifdef FEAT_MULTI_LANG
|
|
||||||
char_u *lang;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
vimconv_T vc;
|
vimconv_T vc;
|
||||||
@@ -6865,10 +6862,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);
|
convert_setup(&vc, (char_u *)"utf-8", p_enc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_MULTI_LANG
|
|
||||||
/* Check for a specified language */
|
|
||||||
lang = check_help_lang(arg);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Go through all the directories in 'runtimepath' */
|
/* Go through all the directories in 'runtimepath' */
|
||||||
p = p_rtp;
|
p = p_rtp;
|
||||||
@@ -6903,6 +6896,7 @@ ex_helpgrep(exarg_T *eap)
|
|||||||
qf_info_T *qi = &ql_info;
|
qf_info_T *qi = &ql_info;
|
||||||
int new_qi = FALSE;
|
int new_qi = FALSE;
|
||||||
char_u *au_name = NULL;
|
char_u *au_name = NULL;
|
||||||
|
char_u *lang = NULL;
|
||||||
|
|
||||||
switch (eap->cmdidx)
|
switch (eap->cmdidx)
|
||||||
{
|
{
|
||||||
@@ -6919,7 +6913,7 @@ ex_helpgrep(exarg_T *eap)
|
|||||||
#endif
|
#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;
|
save_cpo = p_cpo;
|
||||||
p_cpo = empty_option;
|
p_cpo = empty_option;
|
||||||
|
|
||||||
@@ -6930,14 +6924,18 @@ ex_helpgrep(exarg_T *eap)
|
|||||||
return;
|
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.regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING);
|
||||||
regmatch.rm_ic = FALSE;
|
regmatch.rm_ic = FALSE;
|
||||||
if (regmatch.regprog != NULL)
|
if (regmatch.regprog != NULL)
|
||||||
{
|
{
|
||||||
/* create a new quickfix list */
|
// create a new quickfix list
|
||||||
qf_new_list(qi, qf_cmdtitle(*eap->cmdlinep));
|
qf_new_list(qi, qf_cmdtitle(*eap->cmdlinep));
|
||||||
|
|
||||||
hgr_search_in_rtp(qi, ®match, eap->arg);
|
hgr_search_in_rtp(qi, ®match, lang);
|
||||||
|
|
||||||
vim_regfree(regmatch.regprog);
|
vim_regfree(regmatch.regprog);
|
||||||
|
|
||||||
@@ -6950,7 +6948,7 @@ ex_helpgrep(exarg_T *eap)
|
|||||||
if (p_cpo == empty_option)
|
if (p_cpo == empty_option)
|
||||||
p_cpo = save_cpo;
|
p_cpo = save_cpo;
|
||||||
else
|
else
|
||||||
/* Darn, some plugin changed the value. */
|
// Darn, some plugin changed the value.
|
||||||
free_string_option(save_cpo);
|
free_string_option(save_cpo);
|
||||||
|
|
||||||
qf_list_changed(qi, qi->qf_curlist);
|
qf_list_changed(qi, qi->qf_curlist);
|
||||||
@@ -6973,8 +6971,8 @@ ex_helpgrep(exarg_T *eap)
|
|||||||
|
|
||||||
if (eap->cmdidx == CMD_lhelpgrep)
|
if (eap->cmdidx == CMD_lhelpgrep)
|
||||||
{
|
{
|
||||||
/* If the help window is not opened or if it already points to the
|
// If the help window is not opened or if it already points to the
|
||||||
* correct location list, then free the new location list. */
|
// correct location list, then free the new location list.
|
||||||
if (!bt_help(curwin->w_buffer) || curwin->w_llist == qi)
|
if (!bt_help(curwin->w_buffer) || curwin->w_llist == qi)
|
||||||
{
|
{
|
||||||
if (new_qi)
|
if (new_qi)
|
||||||
|
@@ -3091,6 +3091,20 @@ func Test_qf_tick()
|
|||||||
call Xqftick_tests('l')
|
call Xqftick_tests('l')
|
||||||
endfunc
|
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.
|
" The following test used to crash Vim.
|
||||||
" Open the location list window and close the regular window associated with
|
" Open the location list window and close the regular window associated with
|
||||||
" the location list. When the garbage collection runs now, it incorrectly
|
" the location list. When the garbage collection runs now, it incorrectly
|
||||||
|
@@ -794,6 +794,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
315,
|
||||||
/**/
|
/**/
|
||||||
314,
|
314,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user