diff src/quickfix.c @ 11195:13c660bd07b2 v8.0.0484

patch 8.0.0484: :lhelpgrep does not fail after a successful one commit https://github.com/vim/vim/commit/ee85df37634dfb0c40ae5de0b4f246aef460b392 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 19 14:19:50 2017 +0100 patch 8.0.0484: :lhelpgrep does not fail after a successful one Problem: Using :lhelpgrep with an argument that should fail does not produce an error if the previous :helpgrep worked. Solution: Use another way to detect that autocommands made the quickfix info invalid. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Sun, 19 Mar 2017 14:30:04 +0100
parents 501f46f7644c
children ae5f9f26f81c
line wrap: on
line diff
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -5077,6 +5077,7 @@ ex_helpgrep(exarg_T *eap)
     char_u	*lang;
 #endif
     qf_info_T	*qi = &ql_info;
+    qf_info_T	*save_qi;
     int		new_qi = FALSE;
     win_T	*wp;
 #ifdef FEAT_AUTOCMD
@@ -5130,6 +5131,9 @@ ex_helpgrep(exarg_T *eap)
 	}
     }
 
+    /* Autocommands may change the list. Save it for later comparison */
+    save_qi = qi;
+
     regmatch.regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING);
     regmatch.rm_ic = FALSE;
     if (regmatch.regprog != NULL)
@@ -5262,7 +5266,7 @@ 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)
+	if (!new_qi && qi != save_qi && qf_find_buf(qi) == NULL)
 	    /* autocommands made "qi" invalid */
 	    return;
     }