feat: implement a working WinScrolled autocmd

This commit is contained in:
Rom Grk
2020-10-28 03:59:26 -04:00
parent d2a38dab80
commit bc21843228
5 changed files with 47 additions and 9 deletions

View File

@@ -4965,6 +4965,30 @@ 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
*/
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".
*/