aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/autocmd.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-04-12 05:48:23 +0800
committerGitHub <noreply@github.com>2022-04-12 05:48:23 +0800
commitdbd5242d8e10db4ed077547755f0d84aa8261cb5 (patch)
tree507feed5fe2cbfd0e807719424aec1c472de2879 /src/nvim/autocmd.c
parent10b40440ddbdc979a47335790988966b4e9fb6f1 (diff)
parent6be4fd888c4972a411217e486037997720ece6be (diff)
downloadrneovim-dbd5242d8e10db4ed077547755f0d84aa8261cb5.tar.gz
rneovim-dbd5242d8e10db4ed077547755f0d84aa8261cb5.tar.bz2
rneovim-dbd5242d8e10db4ed077547755f0d84aa8261cb5.zip
Merge pull request #18075 from zeertzjq/vim-8.2.4713
vim-patch:8.2.4713: plugins cannot track text scrolling
Diffstat (limited to 'src/nvim/autocmd.c')
-rw-r--r--src/nvim/autocmd.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index f65b5ba983..1b146f82c6 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -1092,6 +1092,15 @@ int autocmd_register(int64_t id, event_T event, char_u *pat, int patlen, int gro
curwin->w_last_cursormoved = curwin->w_cursor;
}
+ // Initialize the fields checked by the WinScrolled trigger to
+ // stop it from firing right after the first autocmd is defined.
+ if (event == EVENT_WINSCROLLED && !has_event(EVENT_WINSCROLLED)) {
+ 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;
+ }
+
ap->cmds = NULL;
*prev_ap = ap;
last_autopat[(int)event] = ap;
@@ -1718,7 +1727,7 @@ bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io, bool f
|| event == EVENT_REMOTEREPLY || event == EVENT_SPELLFILEMISSING
|| event == EVENT_SYNTAX || event == EVENT_SIGNAL
|| event == EVENT_TABCLOSED || event == EVENT_USER
- || event == EVENT_WINCLOSED) {
+ || event == EVENT_WINCLOSED || event == EVENT_WINSCROLLED) {
fname = vim_strsave(fname);
} else {
fname = (char_u *)FullName_save((char *)fname, false);