mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 22:18:33 +00:00
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.
This commit is contained in:
@@ -1267,9 +1267,11 @@ static void normal_check_cursor_moved(NormalState *s)
|
||||
{
|
||||
// Trigger CursorMoved if the cursor moved.
|
||||
if (!finish_op && has_event(EVENT_CURSORMOVED)
|
||||
&& !equalpos(curwin->w_last_cursormoved, curwin->w_cursor)) {
|
||||
&& (last_cursormoved_win != curwin
|
||||
|| !equalpos(last_cursormoved, curwin->w_cursor))) {
|
||||
apply_autocmds(EVENT_CURSORMOVED, NULL, NULL, false, curbuf);
|
||||
curwin->w_last_cursormoved = curwin->w_cursor;
|
||||
last_cursormoved_win = curwin;
|
||||
last_cursormoved = curwin->w_cursor;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user