diff options
Diffstat (limited to 'src/autocmd.c')
-rw-r--r-- | src/autocmd.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/autocmd.c b/src/autocmd.c index 999ee890c..11dc707d7 100644 --- a/src/autocmd.c +++ b/src/autocmd.c @@ -191,6 +191,7 @@ static struct event_name {"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 @@ do_autocmd_event( 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 @@ trigger_cursorhold(void) } /* + * 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 @@ apply_autocmds_group( || event == EVENT_MENUPOPUP || event == EVENT_USER || event == EVENT_WINCLOSED + || event == EVENT_WINRESIZED || event == EVENT_WINSCROLLED) { fname = vim_strsave(fname); |