patch 9.0.0917: the WinScrolled autocommand event is not enough

Problem:    The WinScrolled autocommand event is not enough.
Solution:   Add WinResized and provide information about what changed.
            (closes #11576)
diff --git a/src/autocmd.c b/src/autocmd.c
index 999ee89..11dc707 100644
--- a/src/autocmd.c
+++ b/src/autocmd.c
@@ -191,6 +191,7 @@
     {"WinClosed",	EVENT_WINCLOSED},
     {"WinEnter",	EVENT_WINENTER},
     {"WinLeave",	EVENT_WINLEAVE},
+    {"WinResized",	EVENT_WINRESIZED},
     {"WinScrolled",	EVENT_WINSCROLLED},
     {"VimResized",	EVENT_VIMRESIZED},
     {"TextYankPost",	EVENT_TEXTYANKPOST},
@@ -1263,10 +1264,11 @@
 		if (event == EVENT_MODECHANGED && !has_modechanged())
 		    get_mode(last_mode);
 #endif
-		// Initialize the fields checked by the WinScrolled trigger to
-		// prevent it from firing right after the first autocmd is
-		// defined.
-		if (event == EVENT_WINSCROLLED && !has_winscrolled())
+		// Initialize the fields checked by the WinScrolled and
+		// WinResized trigger to prevent them from firing right after
+		// the first autocmd is defined.
+		if ((event == EVENT_WINSCROLLED || event == EVENT_WINRESIZED)
+			&& !(has_winscrolled() || has_winresized()))
 		{
 		    tabpage_T *save_curtab = curtab;
 		    tabpage_T *tp;
@@ -1811,6 +1813,15 @@
 }
 
 /*
+ * Return TRUE when there is a WinResized autocommand defined.
+ */
+    int
+has_winresized(void)
+{
+    return (first_autopat[(int)EVENT_WINRESIZED] != NULL);
+}
+
+/*
  * Return TRUE when there is a WinScrolled autocommand defined.
  */
     int
@@ -2117,6 +2128,7 @@
 		|| event == EVENT_MENUPOPUP
 		|| event == EVENT_USER
 		|| event == EVENT_WINCLOSED
+		|| event == EVENT_WINRESIZED
 		|| event == EVENT_WINSCROLLED)
 	{
 	    fname = vim_strsave(fname);