diff options
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r-- | src/nvim/window.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c index 2147bd4fc7..9d918ebeb0 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -4975,6 +4975,27 @@ void shell_new_columns(void) win_reconfig_floats(); // The size of floats might change } +/// Check if "wp" has scrolled since last time it was checked +/// @param wp the window to check +bool win_did_scroll(win_T *wp) +{ + return (curwin->w_last_topline != curwin->w_topline + || curwin->w_last_leftcol != curwin->w_leftcol + || curwin->w_last_width != curwin->w_width + || curwin->w_last_height != curwin->w_height); +} + +/// Trigger WinScrolled autocmd +void do_autocmd_winscrolled(win_T *wp) +{ + apply_autocmds(EVENT_WINSCROLLED, NULL, NULL, false, curbuf); + + wp->w_last_topline = wp->w_topline; + wp->w_last_leftcol = wp->w_leftcol; + wp->w_last_width = wp->w_width; + wp->w_last_height = wp->w_height; +} + /* * Save the size of all windows in "gap". */ |