aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/autocmd.h
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-12 09:50:17 +0800
committerGitHub <noreply@github.com>2023-08-12 09:50:17 +0800
commit58a1ef8e6a93c615379f6fbe7234697bcdc42b3e (patch)
treec15b5ac2889ceacf923cca47b2954ab291c9dadf /src/nvim/autocmd.h
parent6c07a189f2d10a533af8a51819ea96c45e0c567e (diff)
downloadrneovim-58a1ef8e6a93c615379f6fbe7234697bcdc42b3e.tar.gz
rneovim-58a1ef8e6a93c615379f6fbe7234697bcdc42b3e.tar.bz2
rneovim-58a1ef8e6a93c615379f6fbe7234697bcdc42b3e.zip
fix(events): avoid unnecessary CursorMoved (#24675)
Problem: Temporarily changing current window in a script causes CursorMoved to be triggerd. Solution: Don't trigger CursorMoved if neither curwin nor cursor changed between two checks.
Diffstat (limited to 'src/nvim/autocmd.h')
-rw-r--r--src/nvim/autocmd.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/autocmd.h b/src/nvim/autocmd.h
index 9e6c534581..b3de57311e 100644
--- a/src/nvim/autocmd.h
+++ b/src/nvim/autocmd.h
@@ -80,6 +80,11 @@ typedef kvec_t(AutoCmd) AutoCmdVec;
// apply_autocmds_group.
EXTERN bool au_did_filetype INIT(= false);
+/// For CursorMoved event
+EXTERN win_T *last_cursormoved_win INIT(= NULL);
+/// For CursorMoved event, only used when last_cursormoved_win == curwin
+EXTERN pos_T last_cursormoved INIT(= { 0, 0, 0 });
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "autocmd.h.generated.h"
#endif