diff options
author | Rom Grk <romgrk.cc@gmail.com> | 2020-10-28 03:59:26 -0400 |
---|---|---|
committer | Rom Grk <romgrk.cc@gmail.com> | 2020-10-28 03:59:26 -0400 |
commit | bc21843228ce255bee8108a78c3c509743c8fe0c (patch) | |
tree | f94bf9a807eddcec037bb78118ee51585204e0b6 /src/nvim/normal.c | |
parent | d2a38dab8085ddb973393ca7f077ff65d64f60ef (diff) | |
download | rneovim-bc21843228ce255bee8108a78c3c509743c8fe0c.tar.gz rneovim-bc21843228ce255bee8108a78c3c509743c8fe0c.tar.bz2 rneovim-bc21843228ce255bee8108a78c3c509743c8fe0c.zip |
feat: implement a working WinScrolled autocmd
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r-- | src/nvim/normal.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index f6add44f6a..2812297347 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -1195,10 +1195,10 @@ static void normal_check_interrupt(NormalState *s) static void normal_check_window_scrolled(NormalState *s) { - // Trigger Scroll if the window moved. - if (!finish_op && has_event(EVENT_SCROLL) - && curwin->w_viewport_invalid) { - apply_autocmds(EVENT_SCROLL, NULL, NULL, false, curbuf); + // Trigger Scroll if the viewport changed. + if (!finish_op && has_event(EVENT_WINSCROLLED) + && win_did_scroll(curwin)) { + do_autocmd_winscrolled(curwin); } } @@ -1325,6 +1325,10 @@ static int normal_check(VimState *state) if (skip_redraw || exmode_active) { skip_redraw = false; } else if (do_redraw || stuff_empty()) { + // Need to make sure w_topline and w_leftcol are correct before + // normal_check_window_scrolled() is called. + update_topline(); + normal_check_cursor_moved(s); normal_check_text_changed(s); normal_check_window_scrolled(s); |