patch 9.1.1084: Unable to persistently ignore events in a window and its buffers
Problem: Unable to persistently ignore events in a window and its buffers.
Solution: Add 'eventignorewin' option to ignore events in a window and buffer
(Luuk van Baal)
Add the window-local 'eventignorewin' option that is analogous to
'eventignore', but applies to a certain window and its buffers. Identify
events that should be allowed in 'eventignorewin', adapt "auto_event"
and "event_tab" to encode this information. Window context is not passed
onto apply_autocmds_group(), and when to ignore an event is a bit
ambiguous when "buf" is not "curbuf", rather than a large refactor, only
ignore an event when all windows into "buf" are ignoring the event.
closes: #16530
Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/optionstr.c b/src/optionstr.c
index 4dda7a0..f912e30 100644
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -2150,29 +2150,34 @@
}
/*
- * The 'eventignore' option is changed.
+ * The 'eventignore(win)' option is changed.
*/
char *
-did_set_eventignore(optset_T *args UNUSED)
+did_set_eventignore(optset_T *args)
{
- if (check_ei() == FAIL)
+ char_u **varp = (char_u **)args->os_varp;
+
+ if (check_ei(*varp) == FAIL)
return e_invalid_argument;
return NULL;
}
+static int expand_eiw = FALSE;
+
static char_u *
get_eventignore_name(expand_T *xp, int idx)
{
- // 'eventignore' allows special keyword "all" in addition to
+ // 'eventignore(win)' allows special keyword "all" in addition to
// all event names.
if (idx == 0)
return (char_u *)"all";
- return get_event_name_no_group(xp, idx - 1);
+ return get_event_name_no_group(xp, idx - 1, expand_eiw);
}
int
expand_set_eventignore(optexpand_T *args, int *numMatches, char_u ***matches)
{
+ expand_eiw = args->oe_varp != (char_u *)&p_ei;
return expand_set_opt_generic(
args,
get_eventignore_name,