vim-patch:9.1.1419: It is difficult to ignore all but some events (#34245)

Problem:  It is difficult to ignore all but some events.
Solution: Add support for a "-" prefix syntax in '(win)eventignore' that
          subtracts an event from the ignored set if present
          (Luuk van Baal).

8cc6d8b187
This commit is contained in:
luukvbaal
2025-05-31 14:51:29 +02:00
committed by GitHub
parent 5ebaf83256
commit 2763d06100
8 changed files with 53 additions and 11 deletions

View File

@@ -1110,12 +1110,20 @@ static bool expand_eiw = false;
static char *get_eventignore_name(expand_T *xp, int idx)
{
bool subtract = *xp->xp_pattern == '-';
// 'eventignore(win)' allows special keyword "all" in addition to
// all event names.
if (idx == 0) {
if (!subtract && idx == 0) {
return "all";
}
return get_event_name_no_group(xp, idx - 1, expand_eiw);
char *name = get_event_name_no_group(xp, idx - 1 + subtract, expand_eiw);
if (name == NULL) {
return NULL;
}
snprintf(IObuff, IOSIZE, "%s%s", subtract ? "-" : "", name);
return IObuff;
}
int expand_set_eventignore(optexpand_T *args, int *numMatches, char ***matches)