0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 9.0.0915: WinScrolled may trigger immediately when defined

Problem:    WinScrolled may trigger immediately when defined.
Solution:   Initialize the fields in all windows. (closes #11582)
This commit is contained in:
Bram Moolenaar
2022-11-20 12:11:45 +00:00
parent 228e422855
commit 2996773276
7 changed files with 93 additions and 15 deletions

View File

@@ -1264,14 +1264,20 @@ do_autocmd_event(
get_mode(last_mode);
#endif
// Initialize the fields checked by the WinScrolled trigger to
// stop it from firing right after the first autocmd is defined.
// prevent it from firing right after the first autocmd is
// defined.
if (event == EVENT_WINSCROLLED && !has_winscrolled())
{
curwin->w_last_topline = curwin->w_topline;
curwin->w_last_leftcol = curwin->w_leftcol;
curwin->w_last_skipcol = curwin->w_skipcol;
curwin->w_last_width = curwin->w_width;
curwin->w_last_height = curwin->w_height;
tabpage_T *save_curtab = curtab;
tabpage_T *tp;
FOR_ALL_TABPAGES(tp)
{
unuse_tabpage(curtab);
use_tabpage(tp);
snapshot_windows_scroll_size();
}
unuse_tabpage(curtab);
use_tabpage(save_curtab);
}
if (is_buflocal)