aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-04-11 16:24:15 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-04-12 05:02:05 +0800
commit53668a5815099f432a5ecebad1d2982ae6813fe6 (patch)
tree0b5e1c37347294ef12e65f4315f3bc95c5cccf89 /src/nvim/normal.c
parent10b40440ddbdc979a47335790988966b4e9fb6f1 (diff)
downloadrneovim-53668a5815099f432a5ecebad1d2982ae6813fe6.tar.gz
rneovim-53668a5815099f432a5ecebad1d2982ae6813fe6.tar.bz2
rneovim-53668a5815099f432a5ecebad1d2982ae6813fe6.zip
vim-patch:8.2.4713: plugins cannot track text scrolling
Problem: Plugins cannot track text scrolling. Solution: Add the WinScrolled event. (closes vim/vim#10102) https://github.com/vim/vim/commit/0937182d49fa8db50cec42785f22f1031760a0bd Skip User event in autocmd.txt, not needed unless #10689 is reverted.
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index dcfd73a631..5b3f27529c 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -1223,10 +1223,9 @@ static void normal_check_interrupt(NormalState *s)
static void normal_check_window_scrolled(NormalState *s)
{
- // Trigger Scroll if the viewport changed.
- if (!finish_op && has_event(EVENT_WINSCROLLED)
- && win_did_scroll(curwin)) {
- do_autocmd_winscrolled(curwin);
+ if (!finish_op) {
+ // Trigger Scroll if the viewport changed.
+ may_trigger_winscrolled(curwin);
}
}
@@ -1353,9 +1352,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.
+ // Ensure curwin->w_topline and curwin->w_leftcol are up to date
+ // before triggering a WinScrolled autocommand.
update_topline(curwin);
+ validate_cursor();
normal_check_cursor_moved(s);
normal_check_text_changed(s);