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)
0937182d49

Skip User event in autocmd.txt, not needed unless #10689 is reverted.
This commit is contained in:
zeertzjq
2022-04-11 16:24:15 +08:00
parent 10b40440dd
commit 53668a5815
8 changed files with 115 additions and 39 deletions

View File

@@ -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);