diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2020-11-07 15:13:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-07 15:13:20 +0100 |
commit | e5d83a3bf344a4ab0ef539d70004c2b771e1044a (patch) | |
tree | c4de9a896700ff8a7131ab430cc108d90fd2774a /src/nvim/window.c | |
parent | da134270d3e9f8a4824b0e0540bf017f7e59b06e (diff) | |
parent | 0fce70252d8e5ccf4cb6f141d1c388966f9f3482 (diff) | |
download | rneovim-e5d83a3bf344a4ab0ef539d70004c2b771e1044a.tar.gz rneovim-e5d83a3bf344a4ab0ef539d70004c2b771e1044a.tar.bz2 rneovim-e5d83a3bf344a4ab0ef539d70004c2b771e1044a.zip |
Merge pull request #13117 from romgrk/add-scroll-events
Implement scroll autocommand
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". */ |