From 82a215cb2dc2b80c1b8bc455c90a928b636d8b3a Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Wed, 12 Feb 2025 11:01:06 +0100 Subject: feat(options): add 'eventignorewin' (#32152) vim-patch:partial: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. https://github.com/vim/vim/commit/b7147f8236c962cd74d1ce028d9106f1c449ea6c vim-patch:9.1.1102: tests: Test_WinScrolled_Resized_eiw() uses wrong filename Problem: tests: Test_WinScrolled_Resized_eiw() uses wrong filename (Luuk van Baal, after v9.1.1084) Solution: Rename the filename to something more unique https://github.com/vim/vim/commit/bfc7719e48ffc365ee0a1bd1888120d26b6365f0 --- src/nvim/optionstr.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/nvim/optionstr.c') diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c index 645bb23638..3a6b4c9936 100644 --- a/src/nvim/optionstr.c +++ b/src/nvim/optionstr.c @@ -1082,27 +1082,32 @@ int expand_set_encoding(optexpand_T *args, int *numMatches, char ***matches) return expand_set_opt_generic(args, get_encoding_name, numMatches, matches); } -/// The 'eventignore' option is changed. -const char *did_set_eventignore(optset_T *args FUNC_ATTR_UNUSED) +/// The 'eventignore(win)' option is changed. +const char *did_set_eventignore(optset_T *args) { - if (check_ei() == FAIL) { + char **varp = (char **)args->os_varp; + + if (check_ei(*varp) == FAIL) { return e_invarg; } return NULL; } +static bool expand_eiw = false; + static char *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 "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 ***matches) { + expand_eiw = args->oe_varp != (char *)&p_ei; return expand_set_opt_generic(args, get_eventignore_name, numMatches, matches); } -- cgit