mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 23: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:
@@ -1287,7 +1287,8 @@ void ins_redraw(bool ready)
|
||||
// Trigger CursorMoved if the cursor moved. Not when the popup menu is
|
||||
// visible, the command might delete it.
|
||||
if (ready && has_event(EVENT_CURSORMOVEDI)
|
||||
&& !equalpos(curwin->w_last_cursormoved, curwin->w_cursor)
|
||||
&& (last_cursormoved_win != curwin
|
||||
|| !equalpos(last_cursormoved, curwin->w_cursor))
|
||||
&& !pum_visible()) {
|
||||
// Need to update the screen first, to make sure syntax
|
||||
// highlighting is correct after making a change (e.g., inserting
|
||||
@@ -1300,7 +1301,8 @@ void ins_redraw(bool ready)
|
||||
// getcurpos()
|
||||
update_curswant();
|
||||
ins_apply_autocmds(EVENT_CURSORMOVEDI);
|
||||
curwin->w_last_cursormoved = curwin->w_cursor;
|
||||
last_cursormoved_win = curwin;
|
||||
last_cursormoved = curwin->w_cursor;
|
||||
}
|
||||
|
||||
// Trigger TextChangedI if changedtick differs.
|
||||
|
Reference in New Issue
Block a user