patch 9.1.1419: It is difficult to ignore all but some events
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).
closes: #17392
Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
647d7f7389
commit
8cc6d8b187
@ -803,16 +803,26 @@ find_end_event(
|
||||
int
|
||||
event_ignored(event_T event, char_u *ei)
|
||||
{
|
||||
int ignored = FALSE;
|
||||
while (*ei != NUL)
|
||||
{
|
||||
if (STRNICMP(ei, "all", 3) == 0 && (ei[3] == NUL || ei[3] == ',')
|
||||
&& (ei == p_ei || (event_tab[event].key <= 0)))
|
||||
return TRUE;
|
||||
if (event_name2nr(ei, &ei) == event)
|
||||
return TRUE;
|
||||
int unignore = *ei == '-';
|
||||
ei += unignore;
|
||||
if (STRNICMP(ei, "all", 3) == 0 && (ei[3] == NUL || ei[3] == ','))
|
||||
{
|
||||
ignored = ei == p_ei || (event_tab[event].key <= 0);
|
||||
ei += 3 + (ei[3] == ',');
|
||||
}
|
||||
else if (event_name2nr(ei, &ei) == event)
|
||||
{
|
||||
if (unignore)
|
||||
return FALSE;
|
||||
else
|
||||
ignored = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return ignored;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -827,13 +837,10 @@ check_ei(char_u *ei)
|
||||
while (*ei)
|
||||
{
|
||||
if (STRNICMP(ei, "all", 3) == 0 && (ei[3] == NUL || ei[3] == ','))
|
||||
{
|
||||
ei += 3;
|
||||
if (*ei == ',')
|
||||
++ei;
|
||||
}
|
||||
ei += 3 + (ei[3] == ',');
|
||||
else
|
||||
{
|
||||
ei += (*ei == '-');
|
||||
event_T event = event_name2nr(ei, &ei);
|
||||
if (event == NUM_EVENTS || (win && event_tab[event].key > 0))
|
||||
return FAIL;
|
||||
|
||||
Reference in New Issue
Block a user