diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-11-20 12:11:45 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-11-20 12:11:45 +0000 |
commit | 29967732761d1ffb5592db5f5aa7036f5b52abf1 (patch) | |
tree | 8ce74785996d6a469d1ab29c7d0f995210f75885 /src/autocmd.c | |
parent | 228e422855d43965f2c3319ff0cdc26ea422c10f (diff) |
patch 9.0.0915: WinScrolled may trigger immediately when definedv9.0.0915
Problem: WinScrolled may trigger immediately when defined.
Solution: Initialize the fields in all windows. (closes #11582)
Diffstat (limited to 'src/autocmd.c')
-rw-r--r-- | src/autocmd.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/autocmd.c b/src/autocmd.c index 8a0992c092..999ee890cb 100644 --- a/src/autocmd.c +++ b/src/autocmd.c @@ -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) |