patch 8.2.3547: opening the quickfix window triggers BufWinEnter twice
Problem: Opening the quickfix window triggers BufWinEnter twice. (Yorick
Peterse)
Solution: Only trigger BufWinEnter with "quickfix". (closes #9022)
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index ff91517..079dcf1 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -2473,6 +2473,7 @@
* ECMD_FORCEIT: ! used for Ex command
* ECMD_ADDBUF: don't edit, just add to buffer list
* ECMD_ALTBUF: like ECMD_ADDBUF and also set the alternate file
+ * ECMD_NOWINENTER: Do not trigger BufWinEnter
* oldwin: Should be "curwin" when editing a new buffer in the current
* window, NULL when splitting the window first. When not NULL info
* of the previous buffer for "oldwin" is stored.
@@ -3030,6 +3031,8 @@
/*
* Open the buffer and read the file.
*/
+ if (flags & ECMD_NOWINENTER)
+ readfile_flags |= READ_NOWINENTER;
#if defined(FEAT_EVAL)
if (should_abort(open_buffer(FALSE, eap, readfile_flags)))
retval = FAIL;
@@ -3051,10 +3054,11 @@
// changed by the user.
do_modelines(OPT_WINONLY);
- apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf,
- &retval);
- apply_autocmds_retval(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf,
- &retval);
+ apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, FALSE,
+ curbuf, &retval);
+ if ((flags & ECMD_NOWINENTER) == 0)
+ apply_autocmds_retval(EVENT_BUFWINENTER, NULL, NULL, FALSE,
+ curbuf, &retval);
}
check_arg_idx(curwin);