diff options
author | Rom Grk <romgrk.cc@gmail.com> | 2020-10-19 12:27:17 -0400 |
---|---|---|
committer | Rom Grk <romgrk.cc@gmail.com> | 2020-10-21 16:18:20 -0400 |
commit | b83d8223ffee099634a4352443cb56a94ebfcc22 (patch) | |
tree | 185b78fe3292f93a24744dc36c9b081af2be0d88 /src/nvim/normal.c | |
parent | 0f590ae2a8bcebcb1398cb30997bd718d6f466e5 (diff) | |
download | rneovim-b83d8223ffee099634a4352443cb56a94ebfcc22.tar.gz rneovim-b83d8223ffee099634a4352443cb56a94ebfcc22.tar.bz2 rneovim-b83d8223ffee099634a4352443cb56a94ebfcc22.zip |
implement scroll autocommand
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r-- | src/nvim/normal.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index a51aa0dc07..eb15204c63 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -1193,6 +1193,22 @@ static void normal_check_interrupt(NormalState *s) } } +static void normal_check_window_scrolled(NormalState *s) +{ + // XXX why is has_event necessary? + + // Trigger Scroll if the window moved. + if (!finish_op && has_event(EVENT_SCROLL) + && (curwin->w_last_topline != curwin->w_topline || + curwin->w_last_leftcol != curwin->w_leftcol)) { + + apply_autocmds(EVENT_SCROLL, NULL, NULL, false, curbuf); + + curwin->w_last_topline = curwin->w_topline; + curwin->w_last_leftcol = curwin->w_leftcol; + } +} + static void normal_check_cursor_moved(NormalState *s) { // Trigger CursorMoved if the cursor moved. @@ -1279,6 +1295,7 @@ static void normal_redraw(NormalState *s) xfree(p); } + // show fileinfo after redraw if (need_fileinfo && !shortmess(SHM_FILEINFO)) { fileinfo(false, true, false); @@ -1318,6 +1335,7 @@ static int normal_check(VimState *state) } else if (do_redraw || stuff_empty()) { normal_check_cursor_moved(s); normal_check_text_changed(s); + normal_check_window_scrolled(s); // Updating diffs from changed() does not always work properly, // esp. updating folds. Do an update just before redrawing if |