patch 9.0.1039: using a <Cmd> mapping CmdlineChanged may be triggered twice
Problem: Using a <Cmd> mapping CmdlineChanged may be triggered twice.
Solution: Count the number of times CmdlineChanged is triggered and avoid
doing it twice. (closes #116820
diff --git a/src/autocmd.c b/src/autocmd.c
index aca990c..20c5afa 100644
--- a/src/autocmd.c
+++ b/src/autocmd.c
@@ -2068,6 +2068,9 @@
&& (event == EVENT_WINLEAVE || event == EVENT_BUFLEAVE)))
goto BYPASS_AU;
+ if (event == EVENT_CMDLINECHANGED)
+ ++aucmd_cmdline_changed_count;
+
/*
* Save the autocmd_* variables and info about the current buffer.
*/
@@ -2088,8 +2091,8 @@
if (fname_io == NULL)
{
if (event == EVENT_COLORSCHEME || event == EVENT_COLORSCHEMEPRE
- || event == EVENT_OPTIONSET
- || event == EVENT_MODECHANGED)
+ || event == EVENT_OPTIONSET
+ || event == EVENT_MODECHANGED)
autocmd_fname = NULL;
else if (fname != NULL && !ends_excmd(*fname))
autocmd_fname = fname;